This is a migrated thread and some comments may be shown as answers.

MaskedTextBoxFor not requiring 0 be filled in

3 Answers 343 Views
MaskedTextBox
This is a migrated thread and some comments may be shown as answers.
Chris T.
Top achievements
Rank 1
Chris T. asked on 15 Jun 2016, 02:17 PM

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?

3 Answers, 1 is accepted

Sort by
0
Marshall Long
Top achievements
Rank 1
answered on 15 Jun 2016, 02:56 PM
Never mind - we found another unrelated error that was causing problems with the page.  Question withdrawn!
0
Marshall Long
Top achievements
Rank 1
answered on 16 Jun 2016, 06:44 PM
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?
0
Georgi Krustev
Telerik team
answered on 17 Jun 2016, 08:17 AM
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
Tags
MaskedTextBox
Asked by
Chris T.
Top achievements
Rank 1
Answers by
Marshall Long
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or