Re: Missing functionality in HTML QuickForm.

From: Date: Tue, 07 Jan 2003 09:25:09 +0000
Subject: Re: Missing functionality in HTML QuickForm.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3204@lists.php.net to get a copy of this message
Wojciech Gdela wrote: > Hello, > > Sometimes I want to add static text in the middle of the form I can do > this in two ways. The first is: > > $defaults['test'] = 'text in the middle of the form'; > $form->setDefaults($defaults); > $el =& $form->createElement('text', 'giodo', null); > $el->freeze(); > $form->addElement($el); > > I think it's ugly, and the second way is: > > $form->addData('<tr><td></td><td valign="top">text in > the middle of the > form</td></tr>'); > > I don't like this one too, since I have to add that html around the text > every time. Shouldn't there be in QuickForm function similar to addData > but with template (like addHeader)? You could also use a template system like PEAR::HTML_Template_IT Quickform has a nice function toArray() which you can use to assign data to your template {vars}. You don't need the setElementTemplate() and addData methods anymore if you use that. But I agree a method similar to addHeader would be useful and shouldn't be too hard to code I guess. Jeroen btw: $form->toArray() fails if you've used the method addData. This is because toArray() expects only objects (I think!)

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