pp108 : validate()

validate()


It validates an element against its data type.

Syntax

Script

bValid = ControlID.validate(oFormatType, bOverwriteFormat)


Parameters

Parameter

Description

oFormat

Object. Refers to the format object that contains thedataTypeand other formatting attributes. This object must be retrieved using thegetFormatType()method.

bOverwriteFormat

Boolean. Denotes whether the default format type can be overwritten by the user-specified format type. Possible values are:

  • true: The default format type on the control is overwritten by the specified format.
  • false: Default.


Return Value


Return true if the value is valid. Otherwise, it returns false.

Remarks

The validation of a control's functionality is done based the following:

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

    This method was earlier supported for WebForm. This is now deprecated. It now applies to the controls mentioned below.

Sample Code


The following example shows how this method can be used.

// Validates the EmployeeID input Field. The ID of the field is "employeeid". The data type of the field is Integer. 
//If a string is entered in the field, then the method returns false.
var bStatus = employeeid.validate();

Applies to


Group, Groupbox, Input, List, Output, Select, Tab Group, Tab Pages, Table, Textarea