Overriding Web Validation Values using FormValidationOverride
In the 3.9 release, we modified the way web validation works to more easily allow the reuse of validation rules among multiple forms. This functionality already exists in the FormValidationOverride input, but that requires the validation rules for a given web form to be declared on the form itself. This enhancement will work similarly but will allow us to define which validation rules apply to a form in the database which will allow other parts of the system outside of form submissions to take advantage of it.
If you want to include required fields in your web pages that are based on an option that a user selects, you can use FormValidationOverride, an input parameter that specifies an alternate form name to use when querying web validation.
You could, for example, design your default request form to allow researchers to request an item as either a loan or a photocopy. You would include two formnames in your WebValidation table, for example, DefaultRequestLoan and DefaultRequestCopy, listing the required fieldnames for each.
In your DefaultRequest.html page, underneath the form name (AeonForm), you would include the FormValidationOverride input parameter with a value of DefaultRequestLoan, and you would include a radio button on your default request form that allows the researcher to request an item as a photocopy.
<input type="hidden" name="FormValidationOverride" value="DefaultRequestLoan">
Multiple FormValidationOverride Tags
The FormValidationOverride tag may be used multiple times within the same web form. This allows you to have a FormValidationOverride tag in a file that is included in a web form using an INCLUDE tag without interfering with any existing FormValidationOverrides already on the form.
The FormValidationOverride tag on the web form is formatted by setting the FormValidationOverride input parameter with a value equal to the Formname entry in the WebValidation table for the override created in the included file. When a request is submitted and the required fields are left blank, input fields for those overrides are included in the web validation processing.
<input type="hidden" name="FormValidationOverride" value="MyIncludeFile">