自适应卡传递选定值

Adapative Card passing selected value

我在这里需要一些帮助..我正在尝试将选定的值传递给我的“操作”表单,我用谷歌搜索了它,但遗憾的是没有解决方案,所以我希望有人可以帮助我解决这个问题问题。我在下面发布了代码,谢谢。

local ChooseId = [==[{
          "$schema": "https://microsoft.github.io/AdaptiveCards/schemas/adaptive-card.json",
                    "type": "AdaptiveCard",
                    "version": "1.0",
                    "body": [
            {

              "type": "TextBlock",
              "text": "Vælg karakter",
              "weight": "Lighter"
            },

            {
              "type": "Input.ChoiceSet",
              "isMultiSelect": false,
              "value": "0",
              "choices": [

                {

                "title": "]==] .. charnames[1][1] .. [==[",
                "id": "1"

                },

                {
                "title": "]==] .. charnames[2][1] .. [==[",
                "id": "2"

                }

              ],

              "style": "expanded"
              
            }
            
          ],

          "actions": [
            {
              "type": "Action.Submit",
              "title": "Sumbit",
              "style": "positive",    
            }
          ]
          
}]==]

要获得 select 输入,您必须对卡片做一些小改动。

ChoiceSet 本身需要有一个 ID 集,选择不需要 ID 但需要值属性。更改后,您会在提交时得到与此类似的内容:

"data": {
  "choice": "2",
}

更新卡片以供参考:

{
      "$schema": "https://microsoft.github.io/AdaptiveCards/schemas/adaptive-card.json",
                "type": "AdaptiveCard",
                "version": "1.0",
                "body": [
        {

          "type": "TextBlock",
          "text": "Vælg karakter",
          "weight": "Lighter"
        },

        {
          "type": "Input.ChoiceSet",
          "isMultiSelect": false,
          "value": "0",
          "id": "choice",
          "choices": [

            {

            "title": "]==] .. charnames[1][1] .. [==[",
            "value": "1"

            },

            {
            "title": "]==] .. charnames[2][1] .. [==[",
            "value": "2"

            }

          ],

          "style": "expanded"
          
        }
        
      ],

      "actions": [
        {
          "type": "Action.Submit",
          "title": "Sumbit",
          "style": "positive"   
        }
      ]
      
 }