Skip to main content

Notifications

Power Platform Community / Forums / General / isRequired tag/flag in...
General
Answered

isRequired tag/flag in Adaptive Cards v 1.3 not working

Posted on by 182

Hello,

 

I am using the below section for the adaptive card, but it is not displaying the card 

 

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "Please provide your details for correspondence"
        },
        {
            "type": "Input.Text",
            "placeholder": "Please enter your Name",
            "id": "Name"  , 
            "isRequired": true,
            "errorMessage": "Required input"
        },
        {
            "type": "Input.Text",
            "placeholder": "Please enter your Email Address",
            "id": "Email",
            "regex": "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+[.][A-Za-z0-9-]{2,4}$",
            "errorMessage": "Please enter a valid email address"  
                   
        },
        {
            "type": "Input.Text",
            "placeholder": "Please enter your Phone Number",
            "id": "Telephone"
        },
        {
            "type": "Input.ChoiceSet",
            "id": "PreferredContact",
            "style": "expanded",
            "label": "Preferred mode of contact is?",
            "isMultiSelect": false,
            "value": "1",
            "choices": [
              {
                "title": "Email",
                "value": "1"
              },
              {
                "title": "Phone",
                "value": "2"
              },
              {
                "title": "Any",
                "value": "3"
              }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    
                    "type": "Action.Submit",
                    "title": "Submit",
                    "style": "positive"
                }
            ]
        }
    ],
    "version": "1.3"
}
 
view in the bot:
nikviz_0-1663842016698.png

 

However, if i remove the isRequired flag, i am getting the template as below

 

nikviz_1-1663842191787.png

 

but, i want the field to be mandatory, is there any way i can do this?

Categories:
  • nikviz Profile Picture
    nikviz 182 on at
    Re: isRequired tag/flag in Adaptive Cards v 1.3 not working

    Hello @Expiscornovus 

    Thank you. It worked. The link  https://adaptivecards.io/designer is really helpful as I was just using https://adaptivecards.io/explorer/Input.Text.html to get the parameters.

  • Verified answer
    Expiscornovus Profile Picture
    Expiscornovus 1,700 on at
    Re: isRequired tag/flag in Adaptive Cards v 1.3 not working

    Hi @nikviz,

     

    What I can see in the Adaptivecards designer on https://adaptivecards.io/designer is that when you make a Input.Text control required you would also need label and errorMessage properties in your json.

     

    label_errormessage.png

     

    Can you try something like below and see if that makes a difference?

     

     

    {
     "type": "Input.Text",
     "placeholder": "Please enter your Name",
     "label": "Name",
     "id": "Name", 
     "isRequired": true,
     "errorMessage": "Required input"
    }

     

     

     

    Also tested it with the json below.

     

     

    {
     "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
     "type": "AdaptiveCard",
     "version": "1.3",
     "body": [
     {
     "type": "TextBlock",
     "text": "Default text input"
     },
     {
     "type": "Input.Text",
     "id": "defaultInputId",
     "label": "Comment",
     "errorMessage": "This is not valid",
     "isRequired": true,
     "placeholder": "enter comment",
     "maxLength": 500
     },
     {
     "type": "TextBlock",
     "text": "Multiline text input"
     },
     {
     "type": "Input.Text",
     "id": "multilineInputId",
     "placeholder": "enter comment",
     "maxLength": 500,
     "isMultiline": true
     },
     {
     "type": "TextBlock",
     "text": "Pre-filled value"
     },
     {
     "type": "Input.Text",
     "id": "prefilledInputId",
     "placeholder": "enter comment",
     "maxLength": 500,
     "isMultiline": true,
     "value": "This value was pre-filled"
     }
     ],
     "actions": [
     {
     "type": "Action.Submit",
     "title": "OK"
     }
     ]
    }

     

     

    label_errormessage02.png

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,990

#3
Expiscornovus Profile Picture

Expiscornovus 1,700