Re: QuickForm dates
| From: | Mitch Pirtle | Date: | Mon, 23 Jun 2003 12:46:44 +0000 |
| Subject: | Re: QuickForm dates | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6190@lists.php.net to get a copy of this message | ||
Graham Clarke wrote:
> Hi - Some questions about using date fields:
>
> 1) What's the syntax for setting a default value for a date field like
> this?
>
> $form->addElement('date', 'dob', 'DoB');
$defaultValues['date'] = date('Y-m-d'); # '2003-06-23'
$form->setDefaults($defaultValues);
<hint>look at the examples</hint>
> 2) If I want to use a regular text box for my date -- like below, how can
> I validate it as a date??
>
> $form->addElement('text', 'dob', 'DoB');
> $input = &$form->getElement('dob');
> $input->setSize(15);
> $input->setMaxLength(15);
I don't think QuickForm does date validation. I suppose you could use
ereg's to check that the year, month and date columns were relatively sane
(or at least numeric).
Anybody on the team have insight on this?