APIs, SDKs, and Services > XML-JSON for Process Central > Validation


Process Central uses jQuery and the jQuery Validation plugin (see http://docs.jquery.com/Plugins/Validation) to perform form data validation. By default, all text input fields are considered to be string type optional fields. In cases where the input text field is required or is not a string (for examplem a number or date), the generated form has its input text fields annotated with CSS class names:
In addition to these validation CSS classnames, you can use any of the validation classnames that are built into the jQuery Validation plugin. For example required (same as avc_required_field), email, and url.
The two main functions within the Request form JavaScript that are related to validation are _setupValidation() and avcform_validate(). The _setupValidation() is where the form validation is initialized as well as where additional validation rules are added. For example, if the HTML form contains an element that is a number with XSD schema minlength and maxlength rules, the set up code may look like:

// Note: this method is auto-generated.
var _setupValidation = function() {
// bind form to the plugin

// limit loan amount input field between 1000 and 5000.
// (see jQuery Validation Plugin for docs).
$("#loanAmount$ID").rules("add", {maxinclusive: 5000, mininclusive: 1000});
// other validation rules ....
The setup function and the additional rules in it are normally automatically generated based on the form's schema (XSD) document. The avcform_validate() function is called prior to the form's submission (for example, when the user presses the Send Request button). The code in this form should return true if the form is valid and Request should be sent to the server. The Request is not sent to the server if this method returns false.
// Note: this method is auto-generated.
var avcform_validate = function() {
// let the jQuery form validation plugin first do the basic validation
if(!$("#loanForm$ID").validate().form()) {
// return false if not valid
return false;
// do further validation if needed (e.g. if A is selected then B and C is required).
// return t/f
return true;
For more information, go to http://docs.jquery.com/Plugins/Validation, which describes the query validation plugin.