Home > Forum > Tips&Tricks > Special characters

Special characters
0

Hi,

I would like to create validation for the input in a column of an item list. I have an item list with two columns (Input, Source). If the Source is "External," I don't want to validate for special characters.

I have been using regex on the column, but now I have this condition.

One solution I thought of is to create a "for each" loop on the item list and add a validation form... But I would prefer it to happen immediately, when user is inputing, not when the user clicks on the next step, like it would work when using regex on the column.

Do you have any ideas?
Thank you.

Hi,
you can make a form rule (and put it in the "Style and behavior" -> "Form rule to be executed on value change") and use javascript to check the regex only if source != "External"

https://www.w3schools.com/jsref/jsref_regexp_test.asp

But obviously, this is only a js validation, so I would check it additionally at the end of the path anyway :-)

MVP

Hi Maria,

If it should be validated, then there is no safer way than Form Validation Action, but if you'd like to improve UX, then i have an idea:

Add new Yes/No column, editable by JS only. Then on change of the column which should be validated - make a form rule, which will validate it, and set that checkbox to true if validation is correct, and false if it's not.

For that validation regex i'd suggest creating a JS form rule with input parameter, and use that inside of column styles and behavior :)