In Symfony2 forms you have the following two from field types (among others):
number: http://symfony.com/doc/2.0/reference/forms/types/number.html
integer: http://symfony.com/doc/2.0/reference/forms/types/integer.html
My questions is why the integer type renders <input type="number"> and the number type renders <input type="text"> thus missing the HTML5 new input types attributes (min, max, step)?
Is there a decent and clean way to configure a number form type to render an <input type="number"> tag (form theming seems a bit dirty to me)?
Edit
Seems like changing the field template is the only option, even though it states a comment {# type="number" doesn't work with floats #}
Actually it could work for
numbertoo, if they set the attributestep="any". However, you can overwrite the block for thenumber-widget and change it to:Check this link, to see the default form layout template:
https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
Edit
This is only a wild guess, but maybe they are not setting
numberto not confuse the user.When you’re on an English system Chrome will accept a value like 1.9. When you type this into Chrome on a German system, the value will be corrected immediately to 19. On a German system you have to type 1,9. Chrome will change this to 1.9 on submit. Imagine the confusion for an unexperienced user who travels a lot. 🙂