-
1. Re: How to get radio button value in onclick?
ilya_shaikovsky Oct 11, 2010 6:03 AM (in response to sivaprasad9394)if you need to pass it to server side - define valuchangelistener and add a4j:support to onclick. Then you will be able to reRender content you need and open another panel in oncomplete.
-
2. Re: How to get radio button value in onclick and open model panel and close modelpanel?
sivaprasad9394 Oct 11, 2010 9:22 PM (in response to ilya_shaikovsky)Hi ilya,
Thanks for your reply.
For me both radio button YES and NO model panel is opening,below is my code,Only for yes i have to show new model panel.old one should be hided.
<a4j:outputPanel ajaxRendered="true">
<a4j:region renderRegionOnly="true">
<h:selectOneRadio id="broadCastOption" valueChangeListener="#{generalInformationBean.selectRadioValue}">
<a4j:support event="onclick" ajaxSingle="true"
reRender="broadCastOption,info_changemobile_editmodal,info_msisdn_no_searchmodal"
oncomplete="if (#{generalInformationBean.rdoButtonFlag == 'true'})Richfaces.hideModalPanel('info_changemobile_editmodal');Richfaces.showModalPanel('info_msisdn_no_searchmodal');" />
<f:selectItem id="yesoption" itemValue="true" itemLabel="Yes"/>
<f:selectItem id="Nooption" itemValue="false" itemLabel="No"/>
</h:selectOneRadio>
</a4j:region>
</a4j:outputPanel>
public void selectRadioValue(ValueChangeEvent event)
{
HtmlSelectOneRadio radio=(HtmlSelectOneRadio) event.getComponent();
System.out.println(radio.getValue());
if(radio.getValue().toString().equalsIgnoreCase("true")){
System.out.println("TRUE:"+radio.getValue().toString());
setRdoButtonFlag(true);
}
else
{
System.out.println("FALSE:"+radio.getValue().toString());
setRdoButtonFlag(false);
}
}
How open only for the YES radio button.??
<a4j:outputPanel ajaxRendered="true"><a4j:region renderRegionOnly="true"><h:selectOneRadio id="broadCastOption" valueChangeListener="#{generalInformationBean.selectRadioValue}"><a4j:support event="onclick" ajaxSingle="true"reRender="broadCastOption,info_changemobile_editmodal,info_msisdn_no_searchmodal"oncomplete="if (#{generalInformationBean.rdoButtonFlag == 'true'})Richfaces.hideModalPanel('info_changemobile_editmodal');Richfaces.showModalPanel('info_msisdn_no_searchmodal');" /><f:selectItem id="yesoption" itemValue="true" itemLabel="Yes"/><f:selectItem id="Nooption" itemValue="false" itemLabel="No"/></h:selectOneRadio></a4j:region></a4j:outputPanel> -
3. Re: How to get radio button value in onclick and open model panel and close modelpanel?
sivaprasad9394 Oct 11, 2010 9:23 PM (in response to sivaprasad9394)HI all,
I have fixed the issue with the following code,
<h:selectOneRadio id="broadCastOption" valueChangeListener="#{generalInformationBean.selectRadioValue}"><a4j:support event="onclick" ajaxSingle="true"reRender="broadCastOption,info_changemobile_editmodal,info_msisdn_no_searchmodal"data="#{generalInformationBean.rdoButtonFlag}"oncomplete="if(data==true){#{rich:component('info_changemobile_editmodal')}.hide();#{rich:component('info_msisdn_no_searchmodal')}.show();}else{return false;}"/><f:selectItem id="yesoption" itemValue="true" itemLabel="Yes"/><f:selectItem id="Nooption" itemValue="false" itemLabel="No"/></h:selectOneRadio><h:selectOneRadio id="broadCastOption" valueChangeListener="#{generalInformationBean.selectRadioValue}">
<a4j:support event="onclick" ajaxSingle="true"
reRender="broadCastOption,info_changemobile_editmodal,info_msisdn_no_searchmodal"
data="#{generalInformationBean.rdoButtonFlag}"
oncomplete="if(data==true)
{
#{rich:component('info_changemobile_editmodal')}.hide();
#{rich:component('info_msisdn_no_searchmodal')}.show();
}
else
{
return false;
}"/>
<f:selectItem id="yesoption" itemValue="true" itemLabel="Yes"/>
<f:selectItem id="Nooption" itemValue="false" itemLabel="No"/>
</h:selectOneRadio>
-
4. Re: How to get radio button value in onclick and open model panel and close modelpanel?
ilya_shaikovsky Oct 12, 2010 6:22 AM (in response to sivaprasad9394)yup I've also used that code when it was requested in the past.