Validation

Form fields may be configured to validate if a numeric value falls within a range or require that a field have an entry. Here is a screenshot of the Form admin page that highlights the relevant fields:

field validation

Most of the field validation is provided by the Struts Validator. Dynasite automatically creates the file used by the Struts Validator to validate max,min, and required field validations. The Form Admin page features a link ("Generate dynaStrutsConfig and dynaValidation.xml Only") that generates the xml files used by Struts. Named dynaStrutsConfig.xml and dynaValidation.xml (affectionately named foo.xml and bar.xml in ZEPRS), these files are generated by GenerateStrutsConfig. GenerateStrutsConfig.modifyConfigFiles iterates through the forms in the database as well as the items in struts-config to generate the struts config (dynaStrutsConfig.xml) and struts validator (dynaValidation.xml) files.

Most of the validation code is from the struts lib; however, ZEPRS has a custom validateTime method in StrutsUtils since Struts does not provide it.

If you upgrade the struts libs/associated xml files, be sure to copy the code for the validateTime function within validator-rules.xml.

When using an input field in edit mode (after double-clicking a current value), the system is unable to use the struts valiadation. Validation must be hard-coded. Edit dwr-display.js updateRecordChart function.