Re: Pear QuickForm date element causing problems
| From: | Sam Miller | Date: | Tue, 10 Aug 2004 15:20:53 +0000 |
| Subject: | Re: Pear QuickForm date element causing problems | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14053@lists.php.net to get a copy of this message | ||
Bertrand Mansion wrote:
Sam Miller wrote:Thanks. I tried the code you supplied. The problem is still the same: The select boxes have an empty option, but it is at the end of each list and it's not selected by default. [I'm using QuickForm version 3.2] Is there a way to set the default value manually? (something like setDefaults() or similar)? thanks SamThanks for your reply. I am also using other date fields where the format is not 'Y Y'. For example there's the following code: $options = array(Obviously, the problem is somewhere in your code unless you can report that the following does not work and send a real reproduce code : <?php require_once 'HTML/QuickForm.php'; $options = array('language' => 'en', 'format' => 'dMYHi', 'addEmptyOption' => TRUE, 'minYear' => 2001, 'maxYear' => 2005, );$this->addElement('date', 'mydate', 'Choose date',$options);It's the same problem here. QuickForm adds an empty option but it is added at the end of the select field and is not selected by default.'language' => 'en', 'format' => 'dMYHi', 'addEmptyOption' => TRUE, 'minYear' => 2001, 'maxYear' => 2005 );$form = new HTML_QuickForm(); $form->addElement('date', 'mydate', 'Choose date',$options); $form->addElement('submit', 'submit', 'submit'); $form->display(); ?> Bertrand Mansion Mamasam