Skip to main content

Notifications

Community site session details

Community site session details

Session Id : GB8pVn3t6OAnNu9zmFi6jd
Power Automate - Building Flows
Unanswered

Adaptive Cards - Require Input

Like (0) ShareShare
ReportReport
Posted on 24 Jul 2020 14:27:27 by 182

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

  • GouravMadan Profile Picture
    2 on 17 Feb 2022 at 07:55:54
    Re: Adaptive Cards - Require Input

    @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

  • cdn4lf Profile Picture
    182 on 24 Jul 2020 at 15:18:46
    Re: Adaptive Cards - Require Input

    no, @ChristianAbata , What I want is for the input to not allow the action.submit to work (title=send), unless there is content there.

  • ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 24 Jul 2020 at 15:08:13
    Re: Adaptive Cards - Require Input

    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.

  • cdn4lf Profile Picture
    182 on 24 Jul 2020 at 15:02:38
    Re: Adaptive Cards - Require Input

    @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}"
     }
     }
     ]
     }
    }
  • ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 24 Jul 2020 at 14:53:20
    Re: Adaptive Cards - Require Input

    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

     

    teamspost.PNG

     

    you are going to be able to use the user response by using the name of the id input 😉 hope this can helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,089 Most Valuable Professional

Leaderboard
Loading started