Hello again!
Is it possible to alter the error message of a failed regex tied to a text input from the system default "Please match the requested format" to something custom such as "please enter valid number"?
Thanks,
Hello again!
Is it possible to alter the error message of a failed regex tied to a text input from the system default "Please match the requested format" to something custom such as "please enter valid number"?
Thanks,
You can create a custom rule
for your input. Something like:
{{ textInput2.value.match(/^[0-9]+$/) == null ? "Only numbers pls" : ""}}
Would that work for you?
Hi @minijohn
I got some errors when trying to use that. Here is my current regex: "\b{{query6.data['Last 4 SS']}}\b"
That regex queries the DB and if the number does not match it shows that validation error of "Please match the requested format". How would you use the custom rule for that regex and have error message as "please enter valid SSN"?
Thanks again!
So the regex in itself can't query the DB, it will execute on a string (that can come from the DB).
If you want to show query6
's results in the textInput1
and have custom validation logic on the input you can:
{{ query6.data['Last 4 SS'] }}
{{ textInput1.value.match(/([0-9])\w+/) == null ? "Please enter a valid SSN" : "" }}
The match
function may not return null, you'll need to have a look there