validate()
validates an Input control
validate(silent?: boolean, validateValue?: string | number): boolean;
Parameters:
silent: boolean
- optional, if true - the method will return the result of validation without calling validation events and without modifying the control visuallyvalidateValue: string | number
- optional, the value to be validated. If not specified, the method validates the current value of the control
Returns:
true
, if a control is valid; otherwise, false
.
Example
// the method validates the specified value
form.getItem("input").validate(true, "I am Input"); // -> true/false
// the method validates the current value
form.getItem("input").validate(true); // -> true/false
When called without parameters, or in case the silent parameter is set to false, the method invokes the BeforeValidate and AfterValidate events and visually modifies the control.
// the method validates the specified value
form.getItem("input").validate(false, "I am Input"); // -> true/false
// the method validates the current value
form.getItem("input").validate(); // -> true/false
Change log:
The silent and validateValue parameters are added in v7.0