0
votes

Recently, I have created an adaptive card form for Microsoft Teams. This adaptive card form will be generated by the flow.

What I want to achieve is the following:

I want to add validations for some fields and make it required.

I have tried to add the following:

{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
    {
        "type": "Input.Text",
        "id": "acEMName",
        "placeholder": "Name",
        "validation": {
            "necessity": "Required",
            "errorMessage": "Employee name is Required"
        }
    }

]}

Unfortunately, what I have tried didn't work as expected, which means I can submit the form even if I didn't fill the field.

Can please someone explain why it doesn't work?

Any help will be greatly appreciated. Thank you.

1
Where did you find that validation property? I don't see it in the schema: adaptivecards.io/explorer/Input.Text.htmlKyle Delaney
Hello Kyle, I have found it on Github(github.com/microsoft/AdaptiveCards/issues/…) it seems that this feature is not available anymore for 1.2vFearLessAZ
It was never available. You can see that the GitHub issue is still open and the feature is planned for v1.3.Kyle Delaney
Are you still working on this?Kyle Delaney

1 Answers

0
votes

Adaptive Cards do not currently have any builtin validation. If you want to validate the inputs then you'll need to do that on the bot side and have the bot give feedback. Teams supports message updates, so you can update the card to include feedback messages if you like.

Michael Richardson's Adaptive Card prompt has support for requiring inputs if you'd like to have a look: https://github.com/microsoft/botframework-sdk/issues/5396