QuickForm ITStatic Renderer and Error Handling
| From: | Jeff Schmidt | Date: | Mon, 17 May 2004 14:28:29 +0000 |
| Subject: | QuickForm ITStatic Renderer and Error Handling | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-12538@lists.php.net to get a copy of this message | ||
Hello,
I've been developing a QuickForm with ITStatic renderer and some templates I created. In the introduction to the IIStatic Renderer, I found the following:
-- begin quote --
If you prefer to have all your errors displayed at the same place, pass an empty string to setErrorTemplate() and add this block to your template at the position you want:
<!-- BEGIN myform_error_loop -->
<font color="red">{myform_error}</font><br />
<!-- END myform_error_loop -->
--end quote--
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 -->
This would result in something that would look like:
-------------------------------------------------------
| The following errors were encountered on this form: |
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
| | | * Error1 | | * Error2 |------------------------------------------------------- Jeff Schmidt
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc