Re: QuickForm ITStatic Renderer and Error Handling

From: Date: Mon, 17 May 2004 14:39:38 +0000
Subject: Re: QuickForm ITStatic Renderer and Error Handling
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12539@lists.php.net to get a copy of this message
Jeff Schmidt wrote: >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: | >| | >| * Error1 | >| * Error2 | >------------------------------------------------------- This should work. Did you try it ? I think it is handled by the remove unknown blocks option in IT/Sigma renderers. BTW, remove useless comments like <!-- outer div exists because MSIE is broken and doesn't correctly implement margin-{left/right}: auto --> from your templates, it just wastes bandwidth and might confuse the regex parser. Bertrand Mansion Mamasam

« previous php.pear.general (#12539) next »