Require Field validation Check for Space bar input

2 posts, 0 answers
  1. Chatra
    Chatra avatar
    61 posts
    Member since:
    Apr 2014

    Posted 23 Sep 2014 Link to this post


    I have a field set to required field validation.But had input given to that field is just  a "Spacebar".

    And the field does not contain any value in it and able to submit the form with empty field.

    How to prevent this... Yaa I can go and use the java script to loop through required fields but then what is use of the required field.

    Chatrapathi Chennam
  2. Rosen
    Rosen avatar
    3253 posts

    Posted 24 Sep 2014 Link to this post

    Hello Chatra,

    The Kendo UI Validator required validation rule tries to mimic the built-in browsers validation behavior - which you can check in this sample test page. However, you may override the built-in required rule and implement it as to fit in your scenario. For example:

      <input name="input" required/>
      <button>Click me</button>
        rules: {
          required: function(input) {
            if (input.filter("[required]").length && $.trim(input.val()) == "") {
              return false;
            return true;

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top