slackapi / java-slack-sdk

Slack Developer Kit (including Bolt for Java) for any JVM language
https://slack.dev/java-slack-sdk/
MIT License
570 stars 209 forks source link

Can we make multiUsersSelect dropdown mandatory, if required? #1255

Closed kranti-rh closed 7 months ago

kranti-rh commented 8 months ago

While working on a feature for Slack bot using Java, I encountered a challenge with the multiUsersSelect dropdown. Unfortunately, there doesn't seem to be a built-in option to make it mandatory. As a workaround, I had to implement a manual check to ensure that at least one value was selected from the dropdown. If the user hasn't selected anything, I reopen the modal. I'm suggesting the addition of a property that would allow making the multiUsersSelect dropdown mandatory more seamlessly.

seratch commented 8 months ago

Hi @kranti-rh, thanks for asking the question. When you don't set optional: true to the input block, all input blocks should be required by default. Could you double-check if your code does not set the optional flag? Also, explicitly pasing optional: false should work for you too.

kranti-rh commented 8 months ago

Hi @seratch, thanks. That worked. So the issue was, previously I was using section(sectionBlockBuilder -> sectionBlockBuilder... instead of input(inputBlockBuilder -> inputBlockBuilder.... Your suggestion input block builder did the job as it has .optional property but section didn't.