I am trying to use the jsf passthrough to conditionally add the checked attribute to radio buttons. It is not working. The checked attribute gets added to the radio button even when the condition returns null. Below is a test I did. What am I doing wrong here?
<h:inputHidden id="testHidden" binding="#{testHidden}" value="1"/>
<input type="radio" a:checked="#{testHidden.value eq '1' ? 'checked' : null}" jsf:id="test1" name="test1" value="1"/>
<input type="radio" a:checked="#{testHidden.value eq '2' ? 'checked' : null}" jsf:id="test2" name="test2" value="2"/>
Below is the HTML they produced:
<input type="hidden" id="viewDevicesSearchForm:testHidden" name="viewDevicesSearchForm:testHidden" value="1">
<input id="viewDevicesSearchForm:test1" name="test1" checked="checked" type="radio" value="1">
<input id="viewDevicesSearchForm:test2" name="test2" checked="" type="radio" value="2">
I am expected test2 element to have no checked attribute, but it has it with a value of “”.
Note: I am using myfaces 3.x.