Forum Discussion

discgolferusa's avatar
discgolferusa
Copper Contributor
Jul 05, 2022

ACE input validation regex property throws error when included in template

I'm trying to use input validation on an input.text field in my card template.   According to the documentation an input.text field should be able to accept isRequired, regex and maxLength as validation properties.

 

When you include the regex property in the JSON though, you get the following error:

 

Something went wrong

If the problem persists, contact the site administrator and give them the information in Technical Details.

ERROR:
syntax error at line 1:1 mismatched input ',' expecting {<EOF>, '+', '-', '!', '^', '*', '/', '%', '==', NOT_EQUAL, '&', '&&', '||', '<', '>', '<=', '>=', '(', '.', '[', '??', '?'}
 
I can take the template JSON and put it in adaptivecard.io/designer and it works as expected on a version 1.3 card.   If I remove the regex fields from my inputs the other validation types work.   

Here is the template json.  I modified a PNP example card to show the issue.


 

 

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.3",
  "body": [{
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": " ${formSample.participantInfoForm.title}",
      "horizontalAlignment": "Center",
      "wrap": true
    },
    {
      "type": "Input.Text",
      "style": "text",
      "id": "SimpleVal",
      "label": "Name", 
      "isRequired" : true,
      "errorMessage": "This name doesnt look valid"
    },
    {
      "type": "Input.Text",
      "placeholder": "email address removed for privacy reasons",
        "errorMessage": "Please enter a valid email address",
        "label": "Your Email",
        "id": "email",
        "isRequired": true,
        "regex": "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"        
    }
  ],
  "actions": [{
      "type": "Action.Submit",
      "title": "Submit",
      "data": {
        "id": "submit"
      }
    },
    {
      "type": "Action.ShowCard",
      "title": "Show Card",
      "card": {
        "type": "AdaptiveCard",
        "body": [{
            "type": "TextBlock",
            "text": "Enter comment",
            "wrap": true
          },
          {
            "type": "Input.Text",
            "style": "text",
            "id": "CommentVal"
          }
        ],
        "actions": [{
          "type": "Action.Submit",
          "title": "OK"
        }],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
      }
    }
  ]
}

 

 

 

Has anyone else encountered this issue with ACE and sharepoint online?

No RepliesBe the first to reply

Resources