Re: QuickForm ITStatic Renderer and Error Handling
| From: | Alexey Borzov | Date: | Mon, 17 May 2004 14:45:05 +0000 |
| Subject: | Re: QuickForm ITStatic Renderer and Error Handling | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12540@lists.php.net to get a copy of this message | ||
Hi!
Jeff Schmidt wrote:
Here's my question: Is it possible to have content *outside* the loop, that gets rendered only if there are errors that get rendered *inside* the loop? To whit, what I want to do is, if I have Errors to display, I'd like to output a pair of div tags (that is, open/close) and a pair of ul tags (again open/close), and a message "The following errors were encountered on this form:" More concrete example: <!-- BEGIN myform_error_block --> <!--is there actually something like this?--? <div style="text-align: center; width: 100%"> <!-- outer div exists because MSIE is broken and doesn't correctly implement margin-{left/right}: auto --> <div style="border: thin solid red; width: 50%; margin-left:auto; margin-right:auto; color: red;"> <h2>The following errors were encountered on this form:</h2> <ul> <!-- BEGIN myform_error_loop --> <li>{myform_error}</li> <!-- END myform_error_loop --> </ul> </div> </div> <!-- END myform_error_block -->I think your example will work. If there are no errors, then the inner block will be empty, as well as the outer one and they'll be removed by the template engine.