Im using this wiki example to submit a form from a radio button:
http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
http://wiki.apache.org/myfaces/JavascriptWithJavaServerFaces
The submit itself is working flawlessly and everything described in the
example is fine. I was wondering how I could also get the value of the
selected radio button passed to the listener method as well. I happen to be
using JBoss Seam components as the business layer, but the main question is,
how can I get the radio's value to submit as well? I've implemented it as
such:
The listener method:
@RequestParameter private String selectedState;
public String getSelectedState() {
return selectedState;
}
public void setSelectedState(String selectedState) {
this.selectedState = selectedState;
}
public String locationsByState(){
availableLocations = new ArrayList<SelectItem>();
loadLocations();
for(int i=0;i<staticLocations.size();i++){
SelectItem current = staticLocations.get(i);
if(current.getDescription().trim().equals(selectedState)){
availableLocations.add(current);
}
}
return display();
}
The View. radioSubmit is generating the JS event as in the example:
<h:selectOneRadio value="#{editProfileAction.selectedState}"
onmouseup="radioSubmit('hiddenLink');" styleClass="bodyCopy"
immediate="true">
<f:selectItem itemLabel="MA" itemValue="MA"/>
<f:selectItem itemLabel="ME" itemValue="ME"/>
<f:selectItem itemLabel="NH" itemValue="NH"/>
<f:selectItem itemLabel="RI" itemValue="RI"/>
<f:selectItem itemLabel="VT" itemValue="VT"/>
</h:selectOneRadio>
<t:commandLink id="hiddenLink" forceId="true" style="display:none;
visibility: hidden;" action="#{editProfileAction.locationsByState}">
</t:commandLink>
Thanks for any suggestions
--
View this message in context:
http://www.nabble.com/Submitting-using-SelectOneRadio-tf2541475.html#a7080992
Sent from the MyFaces - Users mailing list archive at Nabble.com.