validate

Validates the input element(s) against the declared validation rules.

Example

  <div id="myform">
    <input name="username" required /> <br />
    <button id="save">Save</button>
  </div>

  <script>
    // attach a validator to the container and get a reference
    var validatable = $("#myform").kendoValidator().data("kendoValidator");

    //validate the state on button click
    $("#save").click(function() {
      //validate the input elements and check if there are any errors
      if (validatable.validate()) {
        //save the form
      }
    });
  </script>

Returns

Boolean true if all validation rules passed successfully.

Note that if a HTML form element is set as validation container, the form submits will be automatically prevented if validation fails.

In this article
Not finding the help you need? Improve this article