PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

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.