I have a date field for which I have set a validation pattern using its Object palette i.e. Object > Value tab > Validation Pattern > Validation tab. The validation pattern I have there is simply 'date{YYYY-MMM-DD}' with an error message set in the Validation Pattern Message box.
How do I perform this same validation using a javascript in the Validation event?
I'd like to use a script instead so that I can better control when this validation will be performed.
Thanks!!
Marc
Solved! Go to Solution.
Views
Replies
Total Likes
Marc:
If your field has a display picture clause, then you can detect if it formatted correctly by looking at field.formattedValue
Specifically, if the value cannot be formatted, the formattedValue will be the same as the rawValue (unformatted).
So a validation script that specifies:
this.formattedValue !== this.rawValue;
should detect invalid dates.
See: http://blogs.adobe.com/formfeed/2011/06/understanding-field-values.html
good luck
John
Views
Replies
Total Likes
Marc:
If your field has a display picture clause, then you can detect if it formatted correctly by looking at field.formattedValue
Specifically, if the value cannot be formatted, the formattedValue will be the same as the rawValue (unformatted).
So a validation script that specifies:
this.formattedValue !== this.rawValue;
should detect invalid dates.
See: http://blogs.adobe.com/formfeed/2011/06/understanding-field-values.html
good luck
John
Views
Replies
Total Likes
Thanks John, that works well!!
Marc
Views
Replies
Total Likes