I am working on a form where I want to have users enter info in a field called "ID Number" according to a strict pattern. In this case AAA9999-A.
However, if the pattern is not met, I want the field to reset and the focus to be put back into the field. In other words, I don't want the user to move on in the form unless they have entered the value in the field according to the pattern.
It looks like using a validation pattern does not have the capability of clearing the field input and setting the focus. So I wanted to know the best way to do that with script. The only thing is, I don't know how to convert the validation pattern into script syntax and then check for it.
if (TextField1.rawValue === TextField1.formattedValue)
I know there are some cases were we need this but controlling the order the user completes the form is generally considered bad usability, which is why you don't get this behaviour by default.