Re: Upgrading FormBuilder (was Re: [PEAR] HTML_QuickForm_Date display before
| From: | Justin Patrin | Date: | Tue, 18 Jan 2005 21:54:03 +0000 |
| Subject: | Re: Upgrading FormBuilder (was Re: [PEAR] HTML_QuickForm_Date display before | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17004@lists.php.net to get a copy of this message | ||
On Tue, 18 Jan 2005 13:56:04 -0600, Sarah Gray <sarah@fabled.net> wrote:
> >
> > 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
>
> 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.
Well...since I've been part of development for a long time I can't
*really* speak to how much time it takes, but one of my old apps (the
Frontend) was originally written for <0.9 and I updated it pretty
quick. It is small, though.
What exactly are you using from FormBuilder? If you're just using the
processing fucntions you shouldn't have a problem. If you're using
callbacks, this also shouldn't be a problem (I don't believe we
renamed them). If you're setting options in FB in multiple scripts you
should be able to easily change the update scripts to fix all of your
scripts. It's just simple search and replace, so it's not hard to fix.
However, it is quite possible for something to break as BC has been
broken in a few places. This is mostly just naming, though, so it
shouldn't be too bad. Things shouldn't break, some options just won't
be used because they're mis-named.
Make sure to backup. ;-)
>
> 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);
> > > > > > > }
> > > > > > >
--
Justin Patrin