Re: [ANNOUNCEMENT] HTML_QuickForm-2.2 (stable) Released.
| From: | Bertrand Mansion | Date: | Thu, 13 Jun 2002 18:06:24 +0000 |
| Subject: | Re: [ANNOUNCEMENT] HTML_QuickForm-2.2 (stable) Released. | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1656@lists.php.net to get a copy of this message | ||
le 13/06/02 19:24, David Dahl à david@ddahl.com a écrit :
> I thought i would customize the way QuickForm displays forms with CSS by
> subclassing the HTML_QuickForm class. This does not output anything to
> the browser, i am using the example in quickform for testing...
>
> is there an easier way to customize the look with CSS?
>
>
> <?PHP
> require_once ("HTML/QuickForm.php");
> class CSS_QuickForm extends HTML_QuickForm {
>
> //Override html style of the table with CSS
> var $trBgColorHeader;
> var $_requiredNote = "<span class=cssQuickFormRequiredError>* denotes
> required field</span>";
> var $_headerTemplate =
> "\n\t<tr>\n\t\t<td nowrap=\"nowrap\" align=\"left\"
> valign=\"top\" colspan=\"2\"
>
> bgcolor=\"$trBgColorHeader\"><b>{header}</b></td>\n\t</tr>";
> var $_elementTemplate =
> "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!--
> BEGIN
> required --><span class=cssQuickFormRequiredErrorBold>*
> <!-- END required -->{label}</span></td>\n\t\t<td
> nowrap=\"nowrap\" valign=\"top\" align=\"left\"><!-- BEGIN
> error
> --><span class=cssQuickFormRequiredError>{error}</span><!-- END error
> -->\t{element}</td>\n\t</tr>";
> var $_formTemplate =
> "\n<table
>
> border=\"0\">\n\t<form{attributes}>{content}\n\t</form>\n</table>";
> var $_requiredNoteTemplate =
> "\n\t<tr>\n\t\t<td></td>\n\t<td align=\"left\"
> valign=\"top\">{requiredNote}</td>\n\t</tr>";
> }
> ?>
To do that, there's no need to subclass, just use the setElementTemplate,
setHeaderTemplate, setFormTemplate, setRequiredNoteTemplate,
setRequiredNote, setJsWarnings methods to customize it without subclassing.
Make sure your templates contain the right placeholders.
Bertrand Mansion
Mamasam