Doc #18787 [Ana->Csd]: Can't set label on group elements
| From: | borz_off at cs dot msu dot su | Date: | Sat, 18 Feb 2012 14:33:28 +0000 |
| Subject: | Doc #18787 [Ana->Csd]: Can't set label on group elements | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8289@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=18787&edit=1
ID: 18787
Updated by: borz_off@cs.msu.su
Reported By: leonard-php-bugs at ottolander dot nl
Summary: Can't set label on group elements
-Status: Analyzed
+Status: Closed
Type: Documentation Problem
Package: HTML_QuickForm2
Operating System: Linux
Package Version: 0.6.0
PHP Version: Irrelevant
-Assigned To:
+Assigned To: avb
Roadmap Versions:
New Comment:
-Status: Analyzed
+Status: Closed
-Assigned To:
+Assigned To: avb
Templates for grouped elements are now mentioned in renderer docs:
http://pear.php.net/manual/en/package.html.html-quickform2.renderers.php
Previous Comments:
------------------------------------------------------------------------
[2011-09-06 08:22:09] avb
-Status: Open
+Status: Analyzed
-Type: Bug
+Type: Documentation Problem
The example code is correct. However, default templates of default
Renderer do not have placeholders for labels of grouped elements so they
are not output.
Need documentation on how to customize form output.
Currently you can check controller/wizard.php example installed with the
package, it shows adding labels to grouped elements among other things.
------------------------------------------------------------------------
[2011-09-05 16:36:03] leonardjo
Just figured out this is just an error in the example (doc bug). The
correct identifier to set the "label" is 'content' not 'label';
<?php
$fieldset = $form->addFieldset('personal')->setLabel('Personal
Information');
$group =
$fieldset->addGroup('name')->setLabel('Name:')->setSeparator(',
');
$group->addText('first', 'size=10', array('content' =>
'First'));
$group->addText('last', 'size=10', array('content' =>
'Last'));
?>
works as expected.
------------------------------------------------------------------------
[2011-09-05 15:54:28] leonardjo
Description:
------------
The example code in
http://pear.php.net/manual/en/package.html.html-quickform2.qf-migration.php
under "Adding elements to the form" suggests that labels can be added to
group elements. However, the code in the example does not actually add
labels to the text elements.
Also using ->addLabel('First') does not seem to do the trick. No syntax
errors with either approach, but no labels are written.
Test script:
---------------
<?php
$fieldset = $form->addFieldset('personal')->setLabel('Personal
Information');
$group =
$fieldset->addGroup('name')->setLabel('Name:')->setSeparator(',
');
$group->addText('first', 'size=10', array('label' =>
'First'));
$group->addText('last', 'size=10', array('label' =>
'Last'));
?>
<?php
$fieldset = $form->addFieldset('personal')->setLabel('Personal
Information');
$group =
$fieldset->addGroup('name')->setLabel('Name:')->setSeparator(',
');
$group->addText('first', 'size=10')->setLabel('First');
$group->addText('last', 'size=10')->setLabel('Last');
?>
Expected result:
----------------
The labels "First" and "Last" showing.
Actual result:
--------------
No labels "First" and "Last".
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=18787&edit=1