Hi All,
I am trying to build an adaptive card, to run in Teams, what will require the user to complete a Input.Text field.
{
"type": "Input.Text",
"id": "RejectCommentID",
"placeholder": "Please specify the reason.",
"isMultiline": true
}
Is there any way to require this?
Sean
@cdn4lf you can use the "isRequired" property in your input.Text block and make it as true.
For more information you can refer the link: https://adaptivecards.io/explorer/Input.Text.html
no, @ChristianAbata , What I want is for the input to not allow the action.submit to work (title=send), unless there is content there.
ohh @cdn4lf just to understand what you need is like a condition, if the users complete something in your adaptive show up the input?
Because if is sonething like that unfortunally is not possible.
@ChristianAbata Your solution doesn't require a response, it only presents an input field. Please see my complete code. I require the input field to be a mandatory field.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "Container",
"style": "emphasis",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "**Fancy Title - {$root.Position}**",
"wrap": true
}
],
"width": "stretch"
}
]
}
],
"bleed": true
},
{
"type": "ColumnSet",
"id": "MentionColumnSet",
"columns": [
{
"type": "Column",
"id": "MentionColumn",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"id": "MentionTextBlock2",
"spacing": "None",
"isSubtle": true,
"wrap": true,
"text": "Dear <at>John</at>,"
}
]
}
]
},
{
"type": "TextBlock",
"text": "Please help.",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"spacing": "Small",
"size": "Small"
},
{
"text": "Other Words.",
"type": "TextBlock",
"wrap": true
},
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "Please click one of the boxes below to confirm"
},
{
"type": "Container",
"items": [
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Approve",
"style": "positive",
"data": {
"id": "_qkQW8dJlUeLVi7ZMEzYVw",
"action": "approve"
}
},
{
"type": "Action.ShowCard",
"title": "Reject",
"style": "destructive",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "Words."
},
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "More Words."
},
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "Explanation."
},
{
"type": "TextBlock",
"isSubtle": true,
"wrap": true,
"text": "Explanation Paragraph."
},
{
"type": "Input.Text",
"id": "RejectCommentID",
"placeholder": "Please specify the reason.",
"isMultiline": true,
"validation": {
"necessity": "required",
"errorMessage": "A reason for declining is required"
}
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Send",
"data": {
"id": "_qkQW8dJlUeLVi7ZMEzYVw",
"action": "reject"
}
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
}
]
}
]
}
],
"msteams": {
"entities": [
{
"type": "mention",
"text": "<at>John</at>",
"mentioned": {
"id": "8:orgid:{$root.id}",
"name": "{$root.Name} {$root.Surname}"
}
}
]
}
}
yes @cdn4lf please try to use this complete json
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": 2,
"items": [
{
"type": "TextBlock",
"text": "${title}",
"weight": "Bolder",
"size": "Medium"
},
{
"type": "Container",
"$data": "${properties}",
"items": [
{
"type": "Input.Text",
"id": "Response",
"placeholder": "${placeholder}"
}
]
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
]
}
and the action is
you are going to be able to use the user response by using the name of the id input 😉 hope this can helps
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,089
Most Valuable Professional