MaskedTextBoxFor not requiring 0 be filled in

4 posts, 0 answers
  1. Chris T.
    Chris T. avatar
    26 posts
    Member since:
    Apr 2008

    Posted 15 Jun Link to this post

    We have what SHOULD be a simple SSN entry field:

    @Html.Kendo().MaskedTextBoxFor(model => model.SSN).Mask("000-00-0000").UnmaskOnPost(true).HtmlAttributes(new { @class = "form-control", style = "width:125px" })

    The problem we're having is that if we leave some digits not filled in (i.e. - "555-33-2"), no error is thrown.  Aren't the 0s supposed to be required digits?

    Also, we have a regex attribute on the field in the model, for validations when NOT using the edit form (seeds, etc.).  We're planning to disable it by adding the Html attribute @data_val = "false".  Will that prevent the maskedtextbox from doing its work?

  2. Marshall Long
    Marshall Long avatar
    4 posts
    Member since:
    Jun 2008

    Posted 15 Jun in reply to Chris T. Link to this post

    Never mind - we found another unrelated error that was causing problems with the page.  Question withdrawn!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Marshall Long
    Marshall Long avatar
    4 posts
    Member since:
    Jun 2008

    Posted 16 Jun in reply to Marshall Long Link to this post

    On further review, this is still an issue.  When using the 0 to force a digit, why doesn't Telerik throw a client side error?
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 17 Jun Link to this post

    Hello Marshall Long,

    The MaskedTextBox does not have a build-in validation. Any server/client validation should be done separately, like you are doing with the model data annotation attributes.

    If the server/client validation works with a regular Input element, then it will work with the MaskedTextBox.

    Regards,
    Georgi Krustev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready