I want to do some crazy grouping with SelectOneRadio, so I decide to create my own custom component that allow me to specify the name
attribute of the <input>
tag (as you know, same name
means the radio buttons are in the same group). The renderer is correct, so I have a <input>
that used to render like this
<input name="myForm:test1" id="myForm:test1:0" value="0" type="radio">
now render like this
<input name="foo" id="myForm:test1:0" value="0" type="radio">
However, EL stop working when I submit a form (same for h:commandButton and p:commandButton). So if I have this
<xxx:selectOneRadio id="test1" value="#{myBean.selectedFood}">
then EL work, selectedFood
print out the corrected value, but if I put in
<xxx:selectOneRadio id="test1" value="#{myBean.selectedFood}" groupId="foo">
which will make the name=foo
in the <input>
tag. Then EL binding stop working. selectedFood
is null
.
More interestingly, If I put in this
<xxx:selectOneRadio id="test1" value="#{myBean.selectedFood}" groupId="myForm:test1">
which myForm:test1
is the correct client Id, then EL binding work again, so it does not look like it is my code that make the binding stop working. Does JSF require the name
attribute of the input
tag to the client id?