我目前使用螺栓在Python中编写一个小的Slack应用程序。 IM创建模态,以响应斜线命令,该命令由一些普通文本输入字段和两个日期选择器组成。
在 to true
并定义 on_character_entered
作为API参考建议的触发操作。
这样,我可以处理用户将文本输入字段时发出的事件。
这确实很棒,当输入特定的关键字时,我会推出新的模态视图。我存储了当下提交新推出的模态视图以调用 views_update()
时( api )。这个想法是根据第二模态视图的输入更改文本的一部分。
这似乎有效,但不完全做我想要的。普通文本输入没有其值的字段,仅用于 indition_value
(这是我在 views> views_update()
中更改的唯一一件事。
当我返回包含文本输入的第一个模态视图时,它仍然会显示原始文本而不反映更改,但是根据 views> views_update()
call的响应,我可以看到 prinital_value
正确更改。
i 猜测, pritial_value
仅在第一次创建视图时设置文本,但这是否意味着没有办法在不重新创建的情况下更新文本输入的文本值整个视图?
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?
发布评论
评论(1)
好吧,我刚刚找到解决方案 emore 。基本上,您需要强迫Slack在调用
views_update()
时给出新的块ID来重建UI元素(在这种情况下为文本输入字段)。然后,初始值被用来填充文本输入,从而解决了我的问题。
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.