-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
"number" input type maps to "text" input type #8106
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
Still no reply after 2 years? I would agree that the Or should this be closed in favor of #10240? |
it doesn't render as |
To clearify: Symfony 3.0.3 renders NumberType as type="text", and IntegerType as type="number" |
This issue is still persistant in v3.0.6 and was originally marked to be changed in 3.0. |
You can always override the default Twig template for In config.yml: twig:
form_theme:
- "form/fields.html.twig" In templates/form/fields.html.twig: {%- block number_widget -%}
{# https://github.com/symfony/symfony/issues/8106 #}
{%- set type = type|default('number') -%}
{{ block('form_widget_simple') }}
{%- endblock number_widget -%} This seems to work, but I've only just now started testing it. |
The snippet provided by @ianfp does not work for us as alternative. If browser and php language settings do not match, problems may occur. For German numbers Symfony does automatically render |
will be implemented in #30267 |
…" (xabbuh) This PR was merged into the 4.3-dev branch. Discussion ---------- [Form] add option to render NumberType as type="number" | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #8106 | License | MIT | Doc PR | symfony/symfony-docs#10997 Commits ------- 42e8f5e add option to render NumberType as type="number"
I will just leave this here as it took me like 2 min to find out how and where:
|
There is even a comment in src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig stating:
"{# type="number" doesn't work with floats #}",
which isn't true. I'd recommend setting step="any" as a default.
The text was updated successfully, but these errors were encountered: