Error Message Not Showing for Multiselect Menu Modal
See original GitHub issueI would like to display an error message in a modal similar to this example: https://api.slack.com/surfaces/modals/using#displaying_errors. Right now I’m using this code for a multiselect menu: https://slack.dev/bolt-python/concepts#view_submissions.
I do something like this:
client.views_open(
view={
"type": "modal",
"callback_id": "view_1",
"title": {
"type": "plain_text",
"text": "My App",
"emoji": True
},
"submit": {
"type": "plain_text",
"text": "Submit",
"emoji": True
},
"close": {
"type": "plain_text",
"text": "Cancel",
"emoji": True
},
"blocks": [
{
"type": "section",
"block_id": "block1",
"text": {
"type": "mrkdwn",
"text": "*Select channel*"
},
"accessory": {
"type": "multi_conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select Channels",
"emoji": True
},
"action_id": "multi_conversations_select-action"
}
}
]
}
)
Then later:
@slackApp.view("view_1")
def handle_submission(ack, body, client, view):
errors = {}
channels = view["state"]["values"]["block1"]["multi_conversations_select-action"]["selected_conversations"]
if not channels:
errors["block1"] = "Please Select a Channel"
if len(errors) > 0:
print(errors)
ack(response_action="errors", errors=errors)
return
But no red error message shows up on my view saying “Please Select a Channel.” I have tried the same thing with a simple input text box (no drop down menu) with “type”: “plain_text_input” and the red error box does pop up. Is there something I’m missing here?
Another thing I’ve noticed: whenever I choose something from the select menu, I always have this little exclamation point next to the selection box (I assume this means something’s going wrong, I’m just not sure what). I don’t get any error messages and the submission is able to go through successfully though.
Thank you!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
I don’t have anything that I can share at this moment.
@arnav13081994 No, it isn’t. The workaround that you are already doing is the only thing that I can suggest.