Skip to main content

validate()

validates a Combo control

validate(silent?: boolean, validateValue?: string | string[]): boolean;

Parameters:

  • silent: boolean - optional, if true - the method will return the result of validation without calling validation events and without modifying the control visually
  • validateValue: string | string[] - optional, the id(s) of the item(s) from data collection that should be validated. If not specified, the method validates the currently selected item(s).

Returns:

true, if a control is valid; otherwise, false.

Example

// the method validates the specified value
form.getItem("combo").validate(true, "id_2"); // -> true/false

// the method validates the currently selected items
form.getItem("combo").validate(true); // -> true/false

When calling without parameters or setting the silent parameter to false, the method invokes the BeforeValidate and AfterValidate events and visually modifies the control.

// the method validates the specified item
form.getItem("combo").validate(false, "id_2"); // -> true/false

// the method validates the currently selected item(s)
form.getItem("combo").validate(); // -> true/false

Change log:

The silent and validateValue parameters are added in v7.0