pp108 : validateForm()

validateForm()


It validates the values of all controls in a specified XForm. The validation errors, if any, are stacked vertically and displayed on the XForm. Also, the controls that fail validation are outlined in red color to highlight them.

Syntax

Script

bStatus = WebForm.validateForm(sApplicationID)


Parameters

Parameter

Description

sApplicationID

Object that denotes the applicationID of the XForm whose controls must be validated.


Return Value


Returns true or false. If it returns true, then the values of all the controls are valid.

Remarks


The onValidate event fires for every control in an XForm.
The validation of the functionality of controls in an XForm is done based the following:

  • data type
  • custom validation script
  • business logic, if any

Sample Code


The following example shows how this method can be used.

// Called on click of the "saveModels" button.
// Saves the modified data in all models of the current page.
function saveModels_Click(eventObject)
{
   // Validate the values entered in all the controls.
   // Return if there are errors.
   if(!WebForm.validateForm(application.container.applicationId)) return;
   WebForm.saveAllModels(application.container.applicationId);
}

Applies to


WebForm