-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
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:
$builder
->add('aNumber', 'number', array(
'attr' => array('min' => 1, 'max' => 100)
))
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:
$builder
->add('aNumber', 'number', array(
'min' => 1,
'max' => 100
))
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.
CarolineChaudey, j0ssGZ, charlycoste, JamshadAhmad and mohamedchibani