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

Checked attribute alway true for radio button

Details

Submitted2006-03-17 23:09 UTC
Frome dot a dot schultz at gmail dot com
StatusBogus
PackageHTML_QuickForm
PHP Version4.3.9
OSRed Hat Entiprise 4
Roadmaps(Not assigned)

Comments

[2006-03-17 23:09 UTC] e dot a dot schultz at gmail dot com

Description:
------------
When created through a HTML_QuickForm object a radio Element's checked attribute will always remain true. This is the case even after the setChecked(false) method has been called.

Test script:
---------------
$form = new HTML_QuickForm( "test", "post", "index.php");

$radio = $form->createElement("radio");
$radio->setName("tester");
$radio->setText("Radio button to test");
$radio->setChecked(false);

$form->addElement($radio);
$form->display();

Expected result:
----------------
The radio button 'tester' should not be selected by default and the HTML tag should not have a checked="checked" attribute.

Actual result:
--------------
The radio button 'tester' is selected by default and the HTML tag has a checked="checked" attribute.

[2006-03-17 23:13 UTC] e dot a dot schultz at gmail dot com

Actural HTML Generated
-------------------------

Radio button to test

[2006-03-18 20:58 UTC] e dot a dot schultz at gmail dot com

With the value of the radio set the button is unable to be checked.

New Test Code
------------------
$form = new HTML_QuickForm( "test", "post", "index.php");

$radio = $form->createElement("radio");
$radio->setName("tester");
$radio->setText("text");
$radio->setLabel("label");
$radio->setValue("five");
$radio->setChecked(true);
$form->addElement($radio);
$form->display();

Generated HTML
------------------------

label


text

</form>