1

Im currently writing a small Slack App in Python using Bolt. Im creating a Modal in response to a slash command which consists of a few Plain-Text input fields and two date pickers.

On one of the text input fields i set dispatch_action to True and define on_character_entered as trigger action as suggested by the API reference. This way i can handle the event issued when the user enters text into the field.

This does work great and i push a new modal view when a specific keyword is entered. I store the initial's modal view id and hash to access it again when the newly pushed modal view is submitted in order to call views_update() on it (api). The idea is to change parts of the text based on the input of the second modal view.

This seems to work, but does not quite do what i want. The Plain-Text input does not have a field for its value, only for initial_value (which is the only thing i change in the views_update()). When i return to the first modal view which contains the text input it still displays the original text without reflecting the changes, but from the response of the views_update() call i can see that the initial_value was changed correctly.

I guess that the initial_value only sets the text when the view is created for the first time, but does this mean there is no way to update a text input's text value without recreating the whole view?

Ezra Knobloch
  • 91
  • 1
  • 10

1 Answers1

1

Okay i just found the solution here. Basically you need to force slack to rebuild the ui element (in this case the text input field) by giving it a new block id when calling views_update().

Then the initial value gets used to fill the text input thus solving my issue.

Ezra Knobloch
  • 91
  • 1
  • 10