HTML_QuickForm 3.2.4pl, Template Sigma and hidden elements
| From: | Charlie Ward | Date: | Mon, 14 Feb 2005 06:36:54 +0000 |
| Subject: | HTML_QuickForm 3.2.4pl, Template Sigma and hidden elements | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17521@lists.php.net to get a copy of this message | ||
Hi folks,
I think I have found a bug. The script below using the latest version
of QuickForm (3.2.4pl1) and Template Sigma (1.1.2) does NOT display the
hidden elements when rendering with my own sigma template. Yet using
the automatic renderer it renders fine. Changing the version of
HTML_QuickForm down to 3.2.1 means the hidden elements are displayed
both ways (with or without my own template).
Try for yourself!
<?php
/*
1. Run this using HTML_Template_Sigma 1.1.2
HTML_QuickForm version 3.2.4pl1
2. Note how the automatic render 'displays' the hidden elements (look
at the source) but my template does not.
*/
require_once('HTML/QuickForm.php');
require_once('HTML/QuickForm/Renderer/ITStatic.php');
require_once('HTML/Template/Sigma.php');
$form = new HTML_QuickForm('myform','post');
$form->addElement('text', 'street', 'Street Address',
array('size' => 9,
'maxlength' => 9));
$partners[] = &
HTML_QuickForm::createElement('hidden','partner1','');
$partners[] = &
HTML_QuickForm::createElement('hidden','partner2','');
$partners[] = &
HTML_QuickForm::createElement('hidden','partner3','');
$partners[] = &
HTML_QuickForm::createElement('hidden','partner4','');
$form->addGroup($partners,'partners','',' ',FALSE);
$form->addElement('submit', 'submit', 'Add
Project','class=button');
if ($form->validate()) {
exit;
}
// uncomment this line to enable automatic rendering
$form->display();
// comment out this code block and uncomment the line above to
enable automatic rendering
/*
$tpl =& new HTML_Template_Sigma('.');
$tpl->loadTemplateFile('testing.html');
$renderer =& new HTML_QuickForm_Renderer_ITStatic($tpl);
$form->accept($renderer);
$tpl->show();
*/
/**** end template code ****/
?>
*************** testing.html template***********************
<!-- this is a sigma template. It is used to render the oiap_add_proj
form. -->
<br>
{myform_street_label} {myform_street_html}<br/>
{myform_partners_label} {myform_partners_html}
<br />
{myform_submit_html}
<br>
***************************************************************
Any ideas
Cheers
Charlie