Search code examples
jsonadaptive-cardspower-automate

Require Input.Toggle's to be Checked True Before Submitting?


I have the following adaptive card JSON code that has three Input.Toggle's. Is there a way to throw an error when the user clicks "Submit" and all three Input.Toggle's are not set to true? I saw in the Schema Explorer (Schema Explorer Input.Toggle) that they have Inherited properties called "fallback" and "requires", is that what I need? If so, how do I implement "fallback" and "requires" into this JSON code?

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.2",
    "body": [
        {
            "placeholder": "1.1 Business Office Coordinator - RFQ Receipt",
            "type": "Input.Text",
            "id": "Title"
        },
        {
            "text": "Quote #@{body('Get_response_details')?['b194cde8837234ccc80fu5017c1b0f869']} ",
            "type": "TextBlock",
            "id": "textBlock1"
        },
        {
            "type": "Input.Toggle",
            "title": "Customer Acknowledgement",
            "valueOn": "custYes",
            "valueOff": "custNo",
            "id": "Customer"
        },
        {
            "type": "Input.Toggle",
            "title": "Create RFQ Log Number and Enter Information into RFQ Log",
            "valueOn": "RFQYes",
            "valueOff": "RFQNo",
            "id": "RFQ"
        },
        {
            "type": "Input.Toggle",
            "title": "Populate Quote Folder with Customer Data",
            "valueOn": "PopulateYes",
            "valueOff": "PopulateNo",
            "id": "Populate"
        }
    ],
    "actions": [
        {
            "type": "Action.Submit",
            "title": "Submit",
            "data": {
                "id": "9876543210"
            }
        }
    ]
}

Solution

  • this is part of input validation which as of today is not available yet.

    I'm afraid what you're asking for is not possible right now but will hopefully be soon.

    You can follow the feature request here: https://portal.productboard.com/adaptivecards/1-adaptive-cards-features/c/21-input-validation-and-evolution , add your own vote to it aswell if you want to.

    Depending on where you use the card however, you can get this working. In MS Teams you could verify the card submission in your own code and return an error. Its not client side but that way you can still do the check.