Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Need support for client side validation of float and double types #2817

Closed
ajaybhargavb opened this issue Jul 14, 2015 · 2 comments
Closed

Comments

@ajaybhargavb
Copy link
Contributor

After this change #2812, float and double uses type="text" which disables the browser specific validation of number fields.
We need to add support for client side validation. One way of doing that would be to add pattern attribute that contains a regex based on the current culture.

cc' @dougbu @NTaylorMullen

@rubenprins
Copy link

MVC 5 has a ClientDataTypeModelValidatorProvider exactly for this purpose, which emits a data-val-number validation attribute for all basic numeric types (like decimal, float, byte, uint, etc.), and data-val-date for DateTime (exempting DataType.Time). I can't find an analogue in MVC 6.

Although it's probably easier to customize a jQuery Validate rule like number or date (which many of us have had to do already for MVC 3-5), a culture-sensitive (generated) validator could work right out of the box, which is something that's really missing right now.

@ctolkien
Copy link

a culture-sensitive (generated) validator could work right out of the box, which is something that's really missing right now.

I agree with this. On a somewhat related topic, client side validating of dates is a pain if you're not on mm-dd-yy format.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants