Required validation not fireing client-side

2 posts, 0 answers
  1. Mattias
    Mattias avatar
    263 posts
    Member since:
    Aug 2012

    Posted 22 Feb 2013 Link to this post

    Hi,
    I have a box:
    @(Html.Kendo().NumericTextBoxFor(m => m.FilterParticipants).Format("n0").Min(1).Decimals(0))
    with a required attribute:
    [Required(ErrorMessageResourceName = "ValidationRequired", ErrorMessageResourceType = typeof(Resources.Global))]
    //[Min(1, ErrorMessageResourceName = "ValidationRequired", ErrorMessageResourceType = typeof(Resources.Global))]

    public
    int FilterParticipants { get; set; }
    and if I clear the box I can still submit the form.
    But: I also have a datepicker in the form and if I clear that control and tries to submit, then the validation fires (on both controls).

    Regards,
    Mattias

  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 26 Feb 2013 Link to this post

    Hello,

    A problem with the NumericTextBox validation might occur if you are using the jQuery validation because by default it skips hidden inputs. If that is the case, you should override the validator default settings:

    $.validator.setDefaults({
        ignore: ""
    });
    Kind regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top