-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add options "min" and "max" to NumberType #6732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
+1 for this idea, would be great as a convenience |
In fact |
@bschussek why shouldn't we try to guess them to improve the client side validation ? Some other client-side validation attributes are already guessed. |
Could it be you misread my post? :) |
hmm, indeed. |
+1 subscribe |
This is definitely useful here (+1). Wouldn't it make sense to also change number field to render as HTML5 number instead of text? This also relates to ticket #11979 . |
+1 |
What's the point of adding these options instead of using attr? All attributes that have no backend logic have actually been removed, e.g. max_length, pattern, read_only. So I'm rather -1 on doing the same thing with two different approaches. |
As I said, I'm also against adding options if we can also use the attributes. See #15014. |
thank you |
Hi,
At the moment, using the Range validation constraint, we can set up a min & max for a numeric value in an entity property.
Html5 offers min & max attributes for number inputs, so we can also enforce this client-side in any form:
It may be nice to offer min & max options for number field type. It seems pretty logical, as some other fields already have such attributes (ie
max_length
for text fields).The syntax may be:
These attributes will be used client-side & the submitted object will be validated too.
What do you think?
I'm ok about contributing the code (& tests & doc), but I wanted the idea to be reviewed first.
The text was updated successfully, but these errors were encountered: