Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > JavaScript API > Control object > Methods

JavaScript API: Control object > validate()

Scroll Prev Next More

 

Validates the control value against all previously added validation types.

Syntax

var vRes = ctrl.validate();

Arguments

No arguments.

Return value

Returns an array with two values:

result (the validation result, values: true or false);

messageArr (the array of validation errors). If the result is true, then the messageArr array is blank.

Example

Validate the control and display validation errors if there are any using the JavaScript OnLoad event:

 

var ctrl = Runner.getControl(pageid, 'make');
var vRes = ctrl.validate();
if ( !vRes.result ) {
  var message = "";
  for (var i = 0; i < ctrl.validationArr.length ; i++) {
      if ( vRes.messagesData[ ctrl.validationArr[i] ] ) {    
           message += vRes.messagesData[ ctrl.validationArr[i] ].join(" ");
       }
   }
   
   alert( message );
}

See also:

JavaScript API: Control object > getControl()

JavaScript API: Control object > addValidation()

JavaScript API: Control object > removeValidation()

JavaScript API: Control object > validateAs()

JavaScript API: Control object > invalid()

"Edit as" settings: Validation types

Events: JavaScript OnLoad

JavaScript API: Control object

JavaScript API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software