Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:41:33+00:00 2026-06-13T02:41:33+00:00

In Symfony2 forms you have the following two from field types (among others): number

  • 0

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 #}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:41:35+00:00Added an answer on June 13, 2026 at 2:41 am

    Actually it could work for number too, if they set the attribute step="any". However, you can overwrite the block for the number-widget and change it to:

    {% block number_widget %}
    {% spaceless %}
        {% set type = type|default('number') %}
        {{ block('input') }}
    {% endspaceless %}
    {% endblock number_widget %}
    

    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 number to 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. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey i am working on form using the tutorial http://symfony.com/doc/current/book/forms.html I have created a
Does symfony2 have simple button type(not submit or file) for forms? I looked there(http://symfony.com/doc/current/reference/forms/types.html)
I'm trying to use the following technique described on symfony.com : http://symfony.com/doc/current/cookbook/testing/http_authentication.html in an
I have the following Symfony2 form: public function buildForm(FormBuilder $builder, array $options) { $builder
I'm trying to implement a custom field type for my Symfony2 forms but for
I'm getting some troubles understanding how Symfony2 custom form field types work. I need
I have a symfony 1.4 form with 2 embedded forms. The parent form has
I have a little question re Symfony and the automatic creation of forms. Basically
I am using Symfony 1.2.9, and I have a form that contains two date
I have the following routes configuration in a Symfony application: label: url: /label param:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.