0

When using static_select with no option selected by default, is it possible to make the selection of some option mandatory? So that user can't submit the modal without making a selection..

Thanks in advance!

Alexey Buistov
  • 209
  • 2
  • 4
  • 11

3 Answers3

1

Have you created the static_select under a block of 'type' : 'input'? This is what worked for me. I ran across the same issue as you when I had the block as 'type': 'section'.

Adheesh
  • 13
  • 3
0

I got it to work with the following code:

{
  "block_id": "status",
  "type": "input",
  "label": {
    "type": "plain_text",
    "text": "Status"
  },
  "element": {
    "action_id": "status",
    "type": "static_select",
    "placeholder": {
      "type": "plain_text",
      "text": `Select status`,
      "emoji": true
    },
    "options": [
      {
        "text": {
          "type": "plain_text",
          "text":  "OPEN",
          "emoji": true
        },
        "value": ".OPEN"
      },
      {
        "text": {
          "type": "plain_text",
          "text":  "IN_PROGRESS",
          "emoji": true
        },
        "value": ".IN_PROGRESS"
      },
      {
        "text": {
          "type": "plain_text",
          "text":  "COMPLETED",
          "emoji": true
        },
        "value": ".COMPLETED"
      }
    ]
  },
},
Ankit Shubham
  • 2,989
  • 2
  • 36
  • 61
0

simply use the field initial_option, from Slack docs: https://api.slack.com/reference/block-kit/block-elements#select

Yuki
  • 742
  • 7
  • 11