PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #9790

incomplete functionality in Renderer/ITStatic.php

Details

Submitted2007-01-09 22:31 UTC
Frommvonarx at tiscali dot ch
StatusNo Feedback
PackageHTML_QuickForm
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2007-01-09 22:31 UTC] mvonarx at tiscali dot ch

Description:
------------
under some circumstances you may use a form-group with indexed element names.

unfortunately ITStatic deals with these not very well while ITDynamic renders the correct result, even HTML_QuickForm_Renderer_Default works perfect.

A real life example occurs in PEAR's DB_Table:
- you use class DB_Table and its method addFormElements($oForm, array(some fieldnames...) , 'THEARRAYNAME' );
To separate different DB_Table Objects on the same Form you can use different THEARRAYNAME values. DB_Table generates a QuickForm Object with indexed fieldnames i.e. THEARRAYNAME[firstname] etc.

Test script:
---------------
Taken from /docs/renderers/ITStatic_example.php

$form = new HTML_QuickForm('form', 'POST');

$radio[] = &HTML_QuickForm::createElement('radio', null, 'labelB', 'textB', 'valueB');
$radio[] = &HTML_QuickForm::createElement('radio', null, 'labelC', 'textC','valueC');
$radio[] = &HTML_QuickForm::createElement('radio', null, 'labelD', 'textD', 'valueD');
$form->addGroup($radio, 'THEARRAYNAME[someval]' , 'grplabel:', '<br />');

$tpl =& new HTML_Template_Sigma('../template');
$tpl->loadTemplateFile('it-static.html');

$renderer =& new HTML_QuickForm_Renderer_ITDynamic($tpl);
$form->accept($renderer);
$tpl->show();

Expected result:
----------------
clean rendered form

Actual result:
--------------
only the last element of the group is rendered.