Table of Contents

Search

  1. Preface
  2. Overview, Downloading, and Installing
  3. Administration API
  4. Identity Service API
  5. Screenflow Programming and SDK
  6. ActiveVOS WSHT API
  7. Embedding Request Forms in Standalone Web Pages
  8. XML-JSON for Process Central

7. APIs, SDKs, and Services

7. APIs, SDKs, and Services

Validation

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:
  • avc_required_field
    : Makes a field required; for example,
    <input id="loanAmount" type="text" class="avc_required_field" />
    .
  • avc_type_number
    : Checks to see if the data represents a number.
  • avc_type_date
    : Validates the text field as a date string. The format depends on the locale.
  • avc_type_time
    : Checks to see if the input field contains a time value in HH:MM:SS format.
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 $("#loanForm$ID").validate(); // 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.