PEAR is archived and read-only

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

Home » HTML » HTML_Template_Flexy » Bug #6058

setting xhtml-style checked attribute changes value attribute

Details

Submitted2005-11-24 15:35 UTC
Fromrebecca dot blyth at gmail dot com
StatusBogus
PackageHTML_Template_Flexy
PHP Version5.0.5
OSUbuntu Breezy
Roadmaps(Not assigned)

Comments

[2005-11-24 15:35 UTC] rebecca dot blyth at gmail dot com

Description:
------------
I am using the flexy:xhtml attribute with a set of radio buttons. If I create the HTML_Template_Flexy_Element with no arguments to the constructor and manually set attributes['flexy:xhtml'], the output is correct after setting which button is checked by calling setValue(). However, if I set the attribute in the constructor, calling setValue() seems to change the value of each radio button in the set and then set them all to be checked!

I'm using HTML_Template_Flexy version 1.2.3.

Test script:
---------------
// this works as expected
$elements['payment_1_type'] = new HTML_Template_Flexy_Element;
$elements['payment_1_type']->attributes['flexy:xhtml'] = true;
$elements['payment_1_type']->setValue('cq');

// this exhibits the bug
$elements['payment_2_type'] = new HTML_Template_Flexy_Element('input', array('flexy:xhtml' => true));
$elements['payment_2_type']->setValue('cq');

// template contains:
<h2>Attributes array set directly</h2>

<p>Payment method
<br /><input type="radio" name="payment_1_type" id="1" value="cc" /> Credit card
<br /><input type="radio" name="payment_1_type" id="2" value="cq" /> Cheque
</p>

<h2>Attributes set in constructor</h2>

<p>Payment method
<br /><input type="radio" name="payment_2_type" id="3" value="cc" /> Credit card
<br /><input type="radio" name="payment_2_type" id="4" value="cq" /> Cheque
</p>

Expected result:
----------------
<h2>Attributes array set directly</h2>

<p>Payment method
<br />
<input type="radio" name="payment_1_type" id="1" value="cc" /> Credit card
<br />
<input type="radio" name="payment_1_type" id="2" value="cq" checked="checked" /> Cheque
</p>

<h2>Attributes set in constructor</h2>

<p>Payment method
<br />
<input type="radio" name="payment_2_type" id="3" value="cc" /> Credit card
<br />
<input type="radio" name="payment_2_type" id="4" value="cq" checked="checked" /> Cheque
</p>

Actual result:
--------------
<h2>Attributes array set directly</h2>

<p>Payment method
<br /><input type="radio" name="payment_1_type" id="1" value="cc" /> Credit card
<br /><input type="radio" name="payment_1_type" id="2" value="cq" checked="checked" /> Cheque
</p>

<h2>Attributes set in constructor</h2>

<p>Payment method
<br /><input type="radio" name="payment_2_type" id="3" value="cq" checked="checked" /> Credit card
<br /><input type="radio" name="payment_2_type" id="4" value="cq" checked="checked" /> Cheque
</p>