Overriding Web Validation Values using FormValidationOverride


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">
In your javascript, you create functions that tell the DLL what to do when specific actions are taken on the form. When a researcher submits a request, javascript uses the FormValidationOverride default from the html page, (DefautlRequestLoan) unless the user checks the photoduplication option. If the user selects the option to submit the request as a photocopy order, javascript edits the FormValidationOverride value based off of the function for that selection, causing the DLL to display the required fields for the photoduplication form.

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">


If this article didn’t resolve your issue, please take a moment and answer a few questions to help improve our documentation: