AW: [PEAR] QuickForm - can you have radio buttons display on same line, not separated by <BR>?
| From: | Mirco Blitz | Date: | Fri, 12 Nov 2004 14:59:38 +0000 |
| Subject: | AW: [PEAR] QuickForm - can you have radio buttons display on same line, not separated by <BR>? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15472@lists.php.net to get a copy of this message | ||
Hi Stowe,
there are general 2 ways of designing a form with Quickform.
The first is to use GroupEmelents.
Your code would look like this.
$radio1[]=&HTML_QuickForm::createElement('radio','show','Display:','Yes','Y'
);
$radio1[] =
&HTML_QuickForm::createElement('radio','show',null,'No','N');
$form->addGroup($radio1, 'yesnoarray', 'Yes / No');
The second way and in my eyes the more propper is to use a Templating system
like for example IT-Static. Its quite simple.
You define your Form elements as usual.
$form->addElement('radio','show1','Display:','Yes','Y');
$form->addElement('radio','show2',null,'No','N');
Then you define the Template system.
require_once("HTML/Template/ITX.php");
require_once("HTML/QuickForm/Renderer/ITStatic.php");
Then you define wich template to use
$tpl=&new HTML_Template_ITX("./inc/template" /*Template-Path*/);
$tpl->loadTemplatefile("tmpl.myform.htm");
$renderer=&new HTML_QuickForm_Renderer_ITStatic($tpl);
$renderer->setErrorTemplate('<font class="error">{error}</font><br
/>{html}');
And then you show the form
$form->accept($renderer);
$tpl->show();
Here is an example of the template file.
<form {form_attributes}>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td align="left" class="normal">{show1_label}</td>
<td align="left">{show1_html}</td>
</tr>
<tr>
<td align="left" class="normal">{show2_label}</td>
<td align="left">{show2_html}</td>
</tr>
</table>
</form>
The second variation seems to be more complex, but in my experience its more
easy to design, cause you strictly cut out design from processing code and
your Variations of design increase dramatically.
Have Fun
Mirco
-----Ursprüngliche Nachricht-----
Von: Stowe Spivey [mailto:spiveyspivey@yahoo.com]
Gesendet: Freitag, 12. November 2004 15:32
An: pear-general@lists.php.net
Betreff: [PEAR] QuickForm - can you have radio buttons display on same line,
not separated by <BR>?
Here's my code:
$form->addElement('radio','show','Display:','Yes','Y');
$form->addElement('radio','show',null,'No','N');
It displays like this:
Display: Yes
No
I'd rather display it like this:
Display: Yes No
Thanks in advance for any help or ideas.
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php