【问题标题】:Disable submit button/loading on the card on submit in JavaScript adaptive cards在 JavaScript 自适应卡片中提交时禁用提交按钮/加载卡片
【发布时间】:2021-03-24 20:37:04
【问题描述】:

我在提交卡片时有一个表单我希望禁用提交按钮或需要为自适应卡片加载某种类型以避免继续提交表单 谁能帮帮我

卡片:

{
      "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
      "type": "AdaptiveCard",
      "version": "1.3",
      "body": [{
          "type": "TextBlock",
          "text": "Hello !!",
          "size": "Medium",
          "weight": "Bolder"
        },
        {
          "type": "Container",
          "style": "accent",
          "items": [{
              "type": "TextBlock",
              "text": "What was the type?"
            },
            {
              "type": "Input.ChoiceSet",
              "id": "call_type",
              "style": "compact",
              "isRequired": true,
              "errorMessage": " required input",
              "placeholder": "Please choose",
              "choices": [{
                "$data": "${Survey.questions[0].items}",
                "title": "${choice}",
                "value": "${value}"
              }]
            }
          ]
        }
      ],
      "actions": [{
        "type": "Action.Submit",
        "title": "Submit"
      }]
    }

和卡片渲染代码

var jsonTemplate = "some data",
  var jsonDate = "some data"
var template = new ACData.Template(jsonTemplate);
var cardPayload = template.expand({
  $root: jsonData
});
var adaptiveCard = new AdaptiveCards.AdaptiveCard();
adaptiveCard.onExecuteAction = function(action) {
  alert("Ow!");
}
adaptiveCard.parse(cardPayload);
let renderedCard = adaptiveCard.render();
document.body.appendChild(renderedCard);

【问题讨论】:

  • 正在使用 Angular 吗?
  • 我正在使用 React,它是一个 Web 应用程序,因为我正在使用自适应卡片
  • 哦,你应该在这里添加你的代码以便更好地理解
  • 我已经编辑并添加了代码

标签: javascript adaptive-cards


【解决方案1】:

通常流程是在单击按钮时禁用提交按钮(或添加加载掩码),然后将提交请求发送到后端。

在响应到来或请求失败时启用提交按钮(或移除加载掩码)。

【讨论】:

  • 抱歉,我的问题表述不正确,我说的是自适应卡片提交按钮
猜你喜欢
  • 2019-04-22
  • 2020-12-31
  • 2020-03-29
  • 2021-11-28
  • 2019-12-14
  • 2021-11-12
  • 1970-01-01
  • 2020-06-15
  • 2018-10-17
相关资源
最近更新 更多