【问题标题】:Prevent Slack from sending requests after each radio button click防止 Slack 在每次单击单选按钮后发送请求
【发布时间】:2021-12-06 19:09:04
【问题描述】:

我在 Slack 上有一个包含多个输入的表单。 单选按钮似乎用作“提交”按钮。

我想在最后按提交按钮时发送表单。

代码示例:

{
"blocks": [
    {
        "type": "section",
        "text": {
            "type": "mrkdwn",
            "text": "Section block with radio buttons"
        },
        "accessory": {
            "type": "radio_buttons",
            "options": [
                {
                    "text": {
                        "type": "plain_text",
                        "text": "Option1",
                        "emoji": true
                    },
                    "value": "value-0"
                },
                {
                    "text": {
                        "type": "plain_text",
                        "text": "Option2",
                        "emoji": true
                    },
                    "value": "value-1"
                }
            ],
            "action_id": "radio_buttons-action"
        }
    },
    {
        "type": "actions",
        "elements": [
            {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "text": "Submit",
                    "emoji": true
                },
                "value": "click_me_123",
                "action_id": "actionId-0"
            }
        ]
    }
]
}

如何禁用单选按钮充当提交按钮?

【问题讨论】:

  • 你所说的“看起来像'提交'按钮”是什么意思?我真的不认为为此触发了提交按钮的代码
  • 正在触发对我们后端的请求。显然,这是默认行为,无法更改。我从他们的支持团队那里得到了答复。我会发布这个问题的答案

标签: slack slack-api slack-block-kit


【解决方案1】:

我从 Slack 的支持团队得到了答复。显然,目前无法关闭此行为。

Slack 的支持团队:

当用户在模式中使用交互组件时, 将始终调度 block_actions 有效负载。这在这里描述: https://api.slack.com/interactivity/handling#payloads这是设计的 以适应模态的错误处理和动态调整 在提交之前。

无法关闭此功能,但您可以放心地忽略任何 block_actions 有效载荷,只处理 view_submission 有效载荷 一旦你收到了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-30
    • 1970-01-01
    • 1970-01-01
    • 2019-12-10
    • 2017-05-30
    • 1970-01-01
    • 2014-05-13
    相关资源
    最近更新 更多