Skip to content

[Form] Birthday input does not show all dates #5554

@cjwprostar

Description

@cjwprostar

Symfony Standard Edition v2.1.2

While looking at some of the form input options, I found an odd problem. When creating a birthday input using a range above 110 (such as the default of 120), any choices above (date('Y') - 110) aren't being displayed even though an option element is being created. Is anyone else having this problem?

public function indexAction() {
    $form = $this->createFormBuilder()
        ->add('birthday', 'birthday')
        ->add('birthday_working', 'birthday', array(
            'years' => range(date('Y') - 110, date('Y')),
        ))
        ->getForm();

    // Template is the basic form template from the book
    return $this->render('ABCDefaultBundle:Default:default.html.twig', array(
        'form' => $form->createView(),
    ));
}
<div id="form_birthday">
    <select id="form_birthday_year" name="form[birthday][year]" required="required">
        <option value="1892"></option>
        <option value="1893"></option>
        <option value="1894"></option>
        <option value="1895"></option>
        <option value="1896"></option>
        <option value="1897"></option>
        <option value="1898"></option>
        <option value="1899"></option>
        <option value="1900"></option>
        <option value="1901"></option>
        <option value="1902">1902</option>
        <option value="1903">1903</option>
        <option value="1904">1904</option>

... and so on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy