Upgrading FormBuilder (was Re: [PEAR] HTML_QuickForm_Date display before
| From: | Sarah Gray | Date: | Tue, 18 Jan 2005 19:56:04 +0000 |
| Subject: | Upgrading FormBuilder (was Re: [PEAR] HTML_QuickForm_Date display before | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17001@lists.php.net to get a copy of this message | ||
>
> You may also want to consider upgrading. THere have been lots of bug
> fixes and feature additions since 0.9.0. Also, the online docs won't
> be of much help with that version. :-|
>
> There are scripts in CVS to update your ini and class files, although
> I have not tested them recently.
>
> http://cvs.php.net/co.php/pear/DB_DataObject_FormBuilder/fix0.9.0Files.php?r=1.3=Î
> �bGV'®9ÐÍ
I know. I've been avoiding this step because I am afraid of breaking my whole
application, although I know it would be best to do it for a myriad of reasons. For
instance, will the calls in my php scripts (not the classes and ini files) need to
be hand-updated as well? And if things do break, is there a standard way in which
they fail or an estimated 'time it takes to recover'?
I guess my main hesitation is -- since I learned FormBuider using the beta version,
I may have mis-used it in places just by dint of being a newbie at the time -- the
way you do when you're first using a concept or a package (that when you've used it
for a while you see how you might re-do things better). And so these newbie
mistakes, I fear, might wreak havoc in an upgrade. Then again, I might just be
having a small panic attack ;) and everything will be fine, or fine with a few
fixes.
Has anyone updated from 0.9.0 and run into particular situations that are worth
mentioning?
Thanks.
>
>
> >
> > Sarah
> >
> > Joseph Blythe wrote:
> >
> > > Hi,
> > >
> > > We ran into simular troubles when retrieving mySQL timestamps and trying to
> > > use HTML_QuickForm::setDefaults the default date element is a group so
> > > instead of doing:
> > >
> > > $qf->setDefaults('date'=>'1940-02-13');
> > >
> > > format it as an array like (you will need to convert the timestamp first)
> > >
> > > $qf->setDefaults('date'=> array('Y'=>'1940',
> > > 'M'=>'02', 'd'=>'13'));
> > >
> > > Regards,
> > >
> > > Huy and Joseph (hehe took two of us to work that out)
> > >
> > > -----Original Message-----
> > > From: Sarah Gray [mailto:sarah@fabled.net]
> > > Sent: Tuesday, 18 January 2005 3:16 PM
> > > To: Pear
> > > Subject: Re: [PEAR] HTML_QuickForm_Date display before 1969
> > >
> > > Actually, am I just running into this issue because PHP date functions are
> > > only
> > > guaranteed to work after Jan 1, 1970? And so regardless of where I use them,
> > > like
> > > in my HTML_QuickForm_Date elements, I can't get an earlier date? This
> > > didn't
> > > strike me as obvious until a few minutes ago when I was thinking about the
> > > limits
> > > of PHP date, and then I thought 'of course! This is probably the reason my
> > > dropdowns balk when going earlier than 1969 (12-31), and I was looking for
> > > something more complex that had to do with FormBuilder'.
> > >
> > > If I'm right here, to generate date dropdowns for dates prior to 1970 (ie,
> > > birthdays of older people), is there anything you'd recommend other than
> > > creating
> > > individual elements in a group in the form and building a date element
> > > manually?
> > >
> > > Thanks,
> > > Sarah
> > >
> > > Sarah Gray wrote:
> > >
> > > > 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
> > > >
>
> --
> Justin Patrin