Quickform order of elements and required fields
| From: | Keith Edmunds | Date: | Thu, 11 Sep 2003 12:42:22 +0000 |
| Subject: | Quickform order of elements and required fields | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-7719@lists.php.net to get a copy of this message | ||
Code:
$form->addElement('html', $intro);
$form->addElement('text', 'Name', ' First Name:');
$form->addElement('text', 'Email', ' Email:');
$form->addElement('submit', 'btnSubmit', 'OK');
$form->addElement('html', $outro);
$form->addRule('FirstName', 'message', 'required');
$form->addRule('Email', 'message', 'email');
First problem: the FirstName field is displayed with an asterisk to show
that it is required. Howeve, Email is _also_ required (as opposed to the
'emailorblank' rule), so really it should be displayed with the
asterisk. To get around this I added the following:
$form->addRule('Email', 'message', 'required');
Second problem: the order the elements is displayed in is exactly as
listed above EXCEPT that the $outro text is displayed immediately before
the text boxes. Is there a way to get it to display at the foot of the
form?
Thanks,
Keith