I have a Date Field with the Validation Pattern date{MM/DD/YYYY}. Is there a way once the user get the error message the cursor goes back to the Date Field instead of going to the next field.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
You should be able to add the following JavaScript code to the exit event of the date field
if (this.formattedValue === this.rawValue)
{
xfa.host.setFocus(this);
}
This works because the only time the formattedValue is the same as the rawValue is when then edit pattern validation fails (or when then edit pattern is YYYY-MM-DD ... the rawValue pattern).
Note: this goes against Adobe's guidelines for designing forms, they reckon the user should be able to move though the form as they wish but there are a lot of real forms out there that work this way.
Regards
Bruce
Views
Replies
Total Likes
Hi,
You should be able to add the following JavaScript code to the exit event of the date field
if (this.formattedValue === this.rawValue)
{
xfa.host.setFocus(this);
}
This works because the only time the formattedValue is the same as the rawValue is when then edit pattern validation fails (or when then edit pattern is YYYY-MM-DD ... the rawValue pattern).
Note: this goes against Adobe's guidelines for designing forms, they reckon the user should be able to move though the form as they wish but there are a lot of real forms out there that work this way.
Regards
Bruce
Views
Replies
Total Likes
Thanks Bruce this worked great
Best regards
Parre
Views
Replies
Total Likes
Views
Likes
Replies