Hello,
I have a text field set up as a phone number field, with the following in the change event to accept numbers only:
if(xfa.event.newText.match(/[^0-9]/)){
xfa.event.change = "";
}
In the Pattern validation, I have this mask on all tabs (Display, Edit, Validation and Data):
text{'('999')' 999-9999}
I want the user to be able to just enter numbers and have the parentheses and dash added automatically ["(123)-456-7890"].
How do I get the focus to stay on this field when it fails validation? (e.g., insufficient or too many digits). I have looked into validationState but couldn't figure out how to use it (I'm a noob javascripter).
Thanks for any help.
Solved! Go to Solution.
Views
Replies
Total Likes
in the exit event of your field:
if (this.rawValue.length !=9) xfa.host.setFocus(this);
Views
Replies
Total Likes
in the exit event of your field:
if (this.rawValue.length !=9) xfa.host.setFocus(this);
Views
Replies
Total Likes
That worked, thanks! The only change I made was to insert "10" instead of "9" for the phone digits.
if (this.rawValue.length != 10) xfa.host.setFocus(this);
Views
Replies
Total Likes
Yeah, I'll learn how to count one day...
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies