Re: Pear QuickForm date element causing problems
| From: | Justin Patrin | Date: | Tue, 10 Aug 2004 17:23:05 +0000 |
| Subject: | Re: Pear QuickForm date element causing problems | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14057@lists.php.net to get a copy of this message | ||
On Tue, 10 Aug 2004 17:20:53 +0200, Sam Miller <collect@gmx.ch> wrote:
> Bertrand Mansion wrote:
> > Sam Miller wrote:
> >
> >
> >>Thanks 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(
> >> '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.
> >
> >
> > 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
> > );
> > $form = new HTML_QuickForm();
> > $form->addElement('date', 'mydate', 'Choose
> > date',$options);
> > $form->addElement('submit', 'submit', 'submit');
> > $form->display();
> >
> > ?>
> >
> > Bertrand Mansion
> > Mamasam
>
> 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.
>
Well, that code works for me and I assume Bertrand. It must be
something on your end. Are you using the normal renderer? Have you
modified QuickForm in any way?
> [I'm using QuickForm version 3.2]
I don't see any bugs regarding empty options in select boxes fixed
since 3.2, but perhaps you should try upgrading. There have been 3
releases since then (3.2.3).
>
> Is there a way to set the default value manually? (something like
> setDefaults() or similar)?
As a matter of fact setDefaults() does set the defaults....
>
> thanks
>
> Sam
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--