It would be awesome to add a the min an max attribute to the integer type in the Form component. I see the usage in a controller happening like this:
$formBuilder = $this->createFormBuilder(array())
->add('someIntegerField', 'integer', array('min' =>2, 'max' =>5,));
Then the form rendering widget would add the min or max fields to the html input tag.
<input type="number" id="form_someIntegerField" name="form[someIntegerField]" min="2" max="5">
array('attr' => array('min' => ...))
should work. If it is the case you can open a PR to improve the doc.
Note: min/max should be guessed from your validation constraints but I remember of a defect for integers.
Thanks vicb! That worked perfectly. I don't think that was in the documentation...
Excelet !!!!
Most helpful comment
array('attr' => array('min' => ...))
should work. If it is the case you can open a PR to improve the doc.Note: min/max should be guessed from your validation constraints but I remember of a defect for integers.