0

selectOneMenu with forEach as described here (https://stackoverflow.com/a/29676353/1521710) does the job but when trying to use selectOneRadio in same case passthrough is ignored.

Is there any quick way to fix this.

 <h:selectOneRadio...>
  <c:forEach value="#{bean.countries}" var="country">
    <f:selectItem 
        itemValue="#{country}" 
        itemLabel="#{country.countryName}" 
        pt:data-icon="flag flag-#{country.isoCode}" />   
  </c:forEach>             
 </h:selectOneRadio>

It is not the same like in the given link selectOneMenu - generates combo box selectOneRadio - generates radio button goup So it is using different renderes

Community
  • 1
  • 1
Igor Vuković
  • 742
  • 12
  • 25

1 Answers1

0

The solution is quite simple

xhtml

<f:metadata>
    <f:viewParam name="a-radio" value="#{radioButtons.radioButtonJSF22}"/>
</f:metadata>

<label for="fooOption">
  <input type="radio" jsf:id="fooOption" pt:name="a-radio" pt:data-something="someValue" value="Wisconsin"/>
  <span>Wisconsin</span>
</label>
<label for="barOption">
  <input type="radio" jsf:id="barOption" pt:name="a-radio" pt:data-something="someValue"value="Minnesota"/>
  <span>Minnesota</span>
</label>

backing bean

@ManagedBean
public class RadioButtons {

private String radioButtonJSF22;


//...getter and setter for radioButtonJSF22
}

Thanks to this site http://www.leveluplunch.com/java/examples/jsf-radio-buttons/

Igor Vuković
  • 742
  • 12
  • 25