Expand my Community achievements bar.

How to find out if a pattern validation failed

Avatar

Level 2
Hello,



I have Designed a form with several pattern-validations on it. LC's default behavior on such validation is that a message will be shown, but the user is still allowed to leave the field. Even if the entered data is crap.



So is it there any way to clear the field after a validation error or enforce the user to go back to the field?



I know it it possible to mark the validation as an error, so submitting will refuse. But in my case I have a custom submitting procedure, so this won't work.



Thanks for your help.
1 Reply

Avatar

Former Community Member
Edgar:



Instead of using a validation picture, you could put the logic in a FormCalc validation script and use the format() method. Then if it fails you can clear the field and setFocus() back into the field.



Alternatively, you could use a display picture and your validation script could compare rawValue with formattedValue. If a display picture fails, then rawValue and formattedValue will be the same.

I've described this in more detail (with a sample) at:



http://blogs.adobe.com/formfeed/2009/02/calling_formcalc_functions_fro.html



John Brinkman