validate

checks data in the input field

void validate();

Example

$$("querybuilder").validate();

Related samples

Details

You can validate the input value. For this you need to set the validate attribute of the field.

You can make use of the predefined validation rules:

  • isNotEmpty - checks whether a value is empty;
  • isNumber - checks whether a value is number;
  • isEmail - checks whether a value is e-mail (looks for an @-sign, fullstop, text after it);
  • isChecked - checks whether a checkbox is checked.
webix.ui({
  view: "querybuilder",
  fields: [
     {id:"fname", value:"First Name", type:"string", validate: webix.rules.isNotEmpty},
     {id:"lname", value:"Last Name",  type:"string"}
  ]
});

It is also possible to specify a custom rule for validation by defining a custom function:

function ageValidation(value) {
    return webix.rules.isNumber(value) || Array.isArray(value)
}
 
webix.ui({
    view: "querybuilder",
    fields: [
        { id:"age",  value:"Age", type:"number", validate: ageValidation },
        { id:"bdate",  value:"Birth Date", type:"date" }
    ]
});
Back to top