Re: Quickform order of elements and required fields
| From: | Alexey Borzov | Date: | Thu, 11 Sep 2003 12:45:15 +0000 |
| Subject: | Re: Quickform order of elements and required fields | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7720@lists.php.net to get a copy of this message | ||
Hi!
Keith Edmunds wrote:
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');This is the Right Way (tm). If you want the field to be required, you *should* add required rule to it, or else empty field will be considered valid. 'emailorblank' is an artifact of the times when this was not true and should not be used.
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?Please look at the HTML source of the page, not at the browser output. Also consider using 'static' instead of 'html'. 'static' is rendered inside the normal element template, 'html' is just appended as-is.