Re: HTML_QuickForm_Date display before 1969
| From: | Sarah Gray | Date: | Tue, 18 Jan 2005 00:06:39 +0000 |
| Subject: | Re: HTML_QuickForm_Date display before 1969 | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16977@lists.php.net to get a copy of this message | ||
Hi,
>
> You shouldn't have to do this. Put this element in
> $this->fb_preDefElement['DOB'] in preGenerateForm instead of removing
> and recreating in postGenerateForm. This will also remove the need for
> the setValue call below, which could easily break as FB uses
> setDefaults. Try this and see if the problem is fixed.
Thanks for the suggestion -- it is definitely a cleaner way to think about it,
and I removed the calls in postGenerateForm, replacing them with this:
function preGenerateForm(){
$options = array('minYear'=>1924,
'maxYear'=>1990,
'addEmptyOption'=>true,
'format'=>'dMY');
$QF_date = new HTML_QuickForm_date('DOB', 'Date of Birth',$options);
$this->preDefElements['DOB'] = $QF_date;
}
[I'm using an earlier version of FormBuilder, before the fb_ prefixes (version
0.9.0).]
It does create the element as desired, with the proper minYear and maxYear --
but the behaviour is still the same -- not displaying dates before 1969 but
displaying them corerctly after 1969. Any thoughts? An obscure setting
somewhere? Still messed-up syntax?
Thanks.
>
>
> > $options = array('minYear'=>1924,
> > 'maxYear'=>1990,
> > 'addEmptyOption'=>true,
> > 'format'=>'dMY');
> >
> > $QF_date = new HTML_QuickForm_date('DOB', 'Date of Birth',$options);
> > $QF_date->setValue($this->DOB); // the date from the db, formatted
> > 1969-02-14
> > $form->addElement($QF_date);
> > }
> >
> > Thanks -- Sarah
> >
>
> --
> Justin Patrin