'How to perform action on radio button check in Adaptive Card?
I am using Adaptive cards for the Microsoft teams. I am trying to use the radio button by using the "Input.ChoiceSet" type to perform two different tasks by clicking on the radio button. However, unable to perform any action on click of the radio button.
We could not find any property to perform the action. Could you please suggest any way through which we can achieve this
{
type: "Input.ChoiceSet",
id: "incType",
style: "expanded",
isMultiSelect: false,
value: "recurrence",
choices: [
{
title: "one Time",
value: "oneTime"
},
{
title: "Recurring",
value: "recurrence"
}
],
verb: "recurrence_radio_btn_action",
}
Solution 1:[1]
There is no invoke activity sent when a radio button is selected on an adaptive card, instead you could either..
Have an action button (Action.Submit
or Action.Execute
if using Universal Actions outside of a messaging extension):
"body": [
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Choice 1",
"value": "Choice 1"
},
{
"title": "Choice 2",
"value": "Choice 2"
}
],
"style": "expanded"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
],
Or render each option as an action of its own:
"body": [
],
"actions": [
{
"type": "Action.Submit",
"title": "Option 1"
},
{
"type": "Action.Submit",
"title": "Option 2"
}
],
In either case, you would then handle the invoke activity when the relevant button is pressed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Scott Perham |