cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nikviz
Advocate I
Advocate I

isRequired tag/flag in Adaptive Cards v 1.3 not working

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

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



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


nikviz
Advocate I
Advocate I

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.

Helpful resources

Announcements
Power Virtual Agents News & Announcements

Power Virtual Agents News & Announcements

Keep up to date with current events and community announcements in the Power Virtual Agents community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Virtual Agents Community Blog

Power Virtual Agents Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,587)