Re: HTML_Quickform setFormTemplate
| From: | Keith Edmunds | Date: | Fri, 08 Aug 2003 08:24:37 +0000 |
| Subject: | Re: HTML_Quickform setFormTemplate | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7103@lists.php.net to get a copy of this message | ||
On Fri, 08 Aug 2003 09:59:01 +0200
Bertrand Mansion <bmansion@mamasam.com> wrote:
> <keith@midnighthax.com> wrote :
>
> > I've just added the following lines to some code:
> >
> > $template_str = "\n<form{attributes}>\n";
> > $template_str .= "\n{content}\n\n</form>";
> > $form->setFormTemplate($template_str);
> >
> > ...and now I get the error "Method HTML_QuickForm::setFormTemplate()
> > is now deprecated in file xxx".
> >
> > What SHOULD I be doing?
>
> QuickForm now uses renderers for form display.
> The idea is described in the doc:
>
> http://pear.php.net/manual/en/package.html.html-quickform.intro-renderers..ph
> p
>
> Your code becomes:
>
> $renderer =& new HTML_QuickForm_Renderer_Default();
> $template_str = "\n<form{attributes}>\n";
> $template_str .= "\n{content}\n\n</form>";
> $renderer->setFormTemplate($template_str);
>
> It just adds one line for QuickForm renderer instantiation.
Thanks Bertrand. However, this doesn't work for me. I had to add the
line "include_once('HTML/QuickForm/Renderer/Default.php');", but the
output is not changed by the template_str I'm setting. My fault, I'm
sure! I'm outputting the form with "$form->display();", but of course
there is no association between $renderer and my form.
Sorry to ask what I'm sure are basic questions, but although I'm
relatively experienced with PHP I'm finding this hard going right now...
Thanks,
--
Keith Edmunds