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 #6404

Checkbox adding label into html output string

Details

Request #6404Checkbox adding label into html output string
Submitted2006-01-03 11:59 UTC
Fromlarslinnet at gmail dot com
StatusBogus
PackageHTML_QuickForm
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2006-01-03 11:59 UTC] larslinnet at gmail dot com

Description:
------------
It should be said that i use smarty to layout the form.

When using the type of checkbox (at least the one where i found the error in.) it attaches a label to the html output, disallowing you to use the label index in the array.

Even more the Label index is empty.

This is directly from
SmartyDynamic_example.php

I didn't expect to get the labels added into the html string.

This should not be done. it can be changed in checkbox.php.
the function toHtml in that class needs abit of rethinking.

file version:
// $Id: checkbox.php,v 1.19 2004/02/28 22:10:16 avb Exp $
quickform version:
// $Id: QuickForm.php,v 1.151 2004/10/20 18:43:56 avb Exp $

best regard
Lars Stadel Linnet

Test script:
---------------
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C');
$checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D');
$form->addGroup($checkbox, 'ichkABCD', 'ABCD');

Expected result:
----------------
[name] => ichkABCD
[value] => Array
(
[A] => 1
[D] => 1
)

[type] => group
[frozen] =>
[required] =>
[error] =>
[label] => ABCD
[separator] =>
[elements] => Array
(
[0] => Array
(
[name] => ichkABCD[A]
[value] => 1
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] => <label for="qf_9384a6">A</label>
[html] => <input name="ichkABCD[A]" type="checkbox" value="1" id="qf_9384a6" checked="checked" />
)

[1] => Array
(
[name] => ichkABCD[B]
[value] =>
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] => <label for="qf_184c71">B</label>
[html] => <input name="ichkABCD[B]" type="checkbox" value="1" id="qf_184c71" />
)

[2] => Array
(
[name] => ichkABCD[C]
[value] =>
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] => <label for="qf_c86100">C</label>
[html] => <input name="ichkABCD[C]" type="checkbox" value="1" id="qf_c86100" />
)

[3] => Array
(
[name] => ichkABCD[D]
[value] => 1
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] => <label for="qf_9e0ca0">D</label>
[html] => <input name="ichkABCD[D]" type="checkbox" value="1" id="qf_9e0ca0" checked="checked" />
)
)

Actual result:
--------------
[name] => ichkABCD
[value] => Array
(
[A] => 1
[D] => 1
)

[type] => group
[frozen] =>
[required] =>
[error] =>
[label] => ABCD
[separator] =>
[elements] => Array
(
[0] => Array
(
[name] => ichkABCD[A]
[value] => 1
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] =>
[html] => <input name="ichkABCD[A]" type="checkbox" value="1" id="qf_9384a6" checked="checked" /><label for="qf_9384a6">A</label>
)

[1] => Array
(
[name] => ichkABCD[B]
[value] =>
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] =>
[html] => <input name="ichkABCD[B]" type="checkbox" value="1" id="qf_184c71" /><label for="qf_184c71">B</label>
)

[2] => Array
(
[name] => ichkABCD[C]
[value] =>
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] =>
[html] => <input name="ichkABCD[C]" type="checkbox" value="1" id="qf_c86100" /><label for="qf_c86100">C</label>
)

[3] => Array
(
[name] => ichkABCD[D]
[value] => 1
[type] => checkbox
[frozen] =>
[required] =>
[error] =>
[label] =>
[html] => <input name="ichkABCD[D]" type="checkbox" value="1" id="qf_9e0ca0" checked="checked" /><label for="qf_9e0ca0">D</label>
)
)

[2006-01-03 14:18 UTC] larslinnet at gmail dot com

This is also the case with the Radio type.