You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Up to ValidatorFaq


 
 I want to use Validator for client-side
 validation. I put definations in validation.xml, put
 onsubmit="return validateRegistryForm(this);" in my jsp file and do not
 touch validator-rules.xml.  When I press submit button, the javascript
 validation does not work.

 Any wrong with that?

 Leon

Answer(s)

Minimum steps to have built-in validation working:

  1. Add validation plug-in into the struts-config.xml
  2. Put definitions in validation.xml
  3. Add to the page:
    1. In the head section: <html:javascript formName="<form_name>" />
    2. for the form tag: onsubmit="return validate<form_name>(this)"
  4. Create application resource file with required keys (if does not exist

yet)

  1. Add reference to resource file into the struts-config.xml

P.S. it is possible to avoid step #4 and #5 if definitions in validation.xml do not require resources.

Regards, Sergey Smirnov


Up to ValidatorFaq

  • No labels