Re: HTML_QuickForm Date Selectors

From: Date: Wed, 05 Jan 2005 02:42:17 +0000
Subject: Re: HTML_QuickForm Date Selectors
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16617@lists.php.net to get a copy of this message
On Tue, 04 Jan 2005 17:39:30 -0800, Ed Greenberg <edg@greenberg.org> wrote: > Before I re-invent the wheel... > > I have a form that very nicely uses the Smarty {html_select_date} > construct. I am converting the form to use HTML_QuickForm instead. > > Questions: > > * Is there some way to reuse the smarty functionality to generate the date > selectors, and yet validate the data with the HTML_QuickForm validator? > > * Might I add the month, day and year elements in such a fashion that the > field names correspond to what Smarty will generate? Then let Smarty > provide the dropdowns and let Validator do it's thing? Is this the > preferred practice? Yes, this should work as long as the element names are the same. QF really doesn't care if you output the form through it. You can have a static HTML page as your form and just have QF do server-side validation. > > * Can somebody point me to an example of the native use of > HTML_QuickForm_date element? Just create the date element like any other element. You can set various options (see the docs). To set the default, use an array with keys equal to what you put in the format (dMY by default). Always use numeric representations. Such as: $val = array('d' => '4', 'M' => '1', 'Y' => '2005'); $form->setDefaults(array('dateElement' => $val)); > > Thanks, > </edg> > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > !DSPAM:41db4b98326085903511697! > > -- Justin Patrin

« previous php.pear.general (#16617) next »