1) CODE TITLE: Form Validation Framework
2) AUTHOR NAME/NOTES:
SynapticPath
3) DESCRIPTION:
Extensible Form Validation framework that can be easily localized.
Currently it contains validators for:
Dates
Integers
Decimals
AlphaNumeric strings
Alphabetic strings
Required fields
Strings agains regular expressions
Strings by length
Emails
Code example :
Optionally we can instantiate MessageHandler for the entire form that shows localized validation error messagesHTML Code:<!-- Create xml data island that configures a validator, this one will validate onblur--> <xml id="decimalvaldef1" style="display:none;" for="decimalfield" vblur="true"> <!-- Default error message can be overridden/localized --> <converter name="decimal">Decimal field is invalid!</converter> <validator name="decimal" l="15.25" g="6.5"></validator> </xml> <!-- Instantiate event handlers--> <script type="text/javascript"> //Validator agent reads the validator configuration and invokes validation for specified field jsxBehavior("jsx.behaviors.validation.ValidationAgent", "decimalvaldef1"); </script>
4) URL TO CODE:HTML Code:<!-- An element whose id matches "inputid_message" receives that input's validation errros.--> <span id="inputid_message" for="decimalfield"></span> <script type="text/javascript"> //MessageHandler listens to validationError events and outputs the messages to error area defined above jsxBehavior("jsx.behaviors.validation.MessageHandler", "decimalform"); </script>
Example and instructions can be found :
http://synapticpath.dyndns.org:8080/...validation.jsf
or, ATTACHED BELOW (see #3 in guidelines below):



Reply With Quote



Bookmarks