Reputation: 11
I am trying to combine button + text + button (i.e,.cancel button) in the same adaptive card.
I tried to add "textBlock" after "Actions" block, it was not displaying it as expected!
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Please select the buttons to proceed..",
"wrap": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Button1",
"data": "Button1"
},
{
"type": "Action.Submit",
"title": "Button2",
"data": "Button2"
},
"type": "TextBlock",
"text": "Please press Cancel to exit",
{
"type": "Action.Submit",
"title": "Cancel",
"data": "Cancel"
}
]
Expected is: Please select the buttons to proceed.. Button1 Button2 Please press Cancel to exit
Cancel (Button)
Actual result is: No particular error. Its not allowing to include "textBlock" after "Action" block.
Request anybody to help me on this issue. Thank you.
Please find the expected format of Adaptive card image above in the hyperlink (enter image description here).
Upvotes: 1
Views: 195
Reputation: 6393
You can achieve this if you use Containers and ActionSet. As it is, you can't place text blocks inside of the actions property, only the body. However, if you set up a container and place the first text block and button 1 and button 2 within it, you can then follow up it up with a second container with another text block and the cancel button.
This does require you to use version 1.2 as container items only take Actions placed in an ActionSet. If you are set on needing the second text block placed between the second and third button, then this is how you can do it, but be aware that v1.2 has not been implemented everywhere. You will want to specify the fallback to cover those cases.
You can also visit the Adaptive Card Designer to experiment more.
Hope of help!
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Please select the buttons to proceed...",
"wrap": true,
"weight": "Bolder"
},
{
"type": "Container",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Button1",
"data": "Button1"
},
{
"type": "Action.Submit",
"title": "Button2",
"data": "Button2"
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Please press Cancel to exit",
"horizontalAlignment": "Center"
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Cancel",
"data": "Cancel"
}
]
}
]
}
Hope of help!
Upvotes: 1