Skip to content

Commit da7da61

Browse files
authored
update block id from listening modals (#472)
current, the serial order in which a user reads the documentation sets the opening_modals example as a pre-requisite that the listening_modals builds upon. Currently, an attempt to walk through the examples in order yeilds a python `keyError: 'block_c'` This is because block_c does not match the name of the previous modal examle `input_c`. This patch updates the variable to be the same so that users can step through the documentation without the above exception.
1 parent 7173ef7 commit da7da61

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/_basic/listening_modals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Read more about view submissions in our <a href="https://api.slack.com/surfaces/
2121
# Handle a view_submission request
2222
@app.view("view_1")
2323
def handle_submission(ack, body, client, view, logger):
24-
# Assume there's an input block with `block_c` as the block_id and `dreamy_input`
25-
hopes_and_dreams = view["state"]["values"]["block_c"]["dreamy_input"]
24+
# Assume there's an input block with `input_c` as the block_id and `dreamy_input`
25+
hopes_and_dreams = view["state"]["values"]["input_c"]["dreamy_input"]
2626
user = body["user"]["id"]
2727
# Validate the inputs
2828
errors = {}
2929
if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
30-
errors["block_c"] = "The value must be longer than 5 characters"
30+
errors["input_c"] = "The value must be longer than 5 characters"
3131
if len(errors) > 0:
3232
ack(response_action="errors", errors=errors)
3333
return

0 commit comments

Comments
 (0)