affected-fewarea-mvcbugfeature-mvc-razor-viewshelp wantedseverity-minor
Description
Data of floating point types are incorrectly forced to be numbers in general format by client-side validation, without accounting for the possibility of values displayed or inserted in scientific notation. The data-val-number tag is automatically added to, and cannot be trivially removed from the generated HTML. This causes an inconsistency because it suffices to define a default value small or big enough to be displayed in scientific notation (say, 1.0e-5) to receive a validation error at submission even if the entry is perfectly valid.
To Reproduce
Steps to reproduce the behavior:
- Create a model with a double data member.
- Scaffold a Razor Page with CRUD for the model at point 1.
- Try to insert a value in scientific notation in the text box for the variable of double type.
- See error
Expected behavior
There are two possibilities: a) values in scientific notation are accepted b) a custom validator should be able to override the data-val-number setting