Radio Button event with ajax
843844Jan 12 2010 — edited Jan 12 2010Hi friends,
I have radio buttons inside tabpanel. Now i need to implement event in this radio button such that i am able to update values in my back bean and update certain section on page as well.
This is the xhtml i am using.
<h:selectOneRadio value="percent" title="Select any one of the choice" styleClass="font_normal5">
<f:selectItem itemLabel="#{msgs.hundred}" itemValue="percent" />
<f:selectItem itemLabel="#{msgs.your_share}" itemValue="share" />
<f:selectItem itemLabel="#{msgs.bureau_share}" itemValue="bureau" />
<a4j:support event="onclick" ajaxSingle="true" reRender="container" immediate="true" actionListener="#{financialDetailsHandler.processValueChange}"/> //to rerender
</h:selectOneRadio>
<div id="container" class="transaction_structure1"> //this whole div should be updated
<div class="transaction_leftstructure">
<p class="transaction_lineheight">
#{msgs.osnd} :
#{msgs.original_currency}
#{msgs.outstanding_qualifier}
#{msgs.incurred} :
#{msgs.outstanding_amount} :
#{msgs.previously_paid} :
#{msgs.outstanding_fees} :
#{msgs.settlement_amt} :
#{msgs.vat} :
</p>
</div>
<div class="rightstructure10">
<p class="transaction_lineheight">
<h:outputText value="#{financialDetailsHandler.financialDetailsBean.name}"/>
//this shpuld update
<h:outputText value="#{financialDTO.originalCurrency}"/>
<h:outputText value="#{financialDTO.outstandingQual}"/>
</p>
</div>
</div>
//Method which gets called in my method
public void processValueChange(ActionEvent vce)
{
System.out.println("ABC");
HtmlAjaxSupport value = (HtmlAjaxSupport)vce.getComponent();
HtmlSelectOneRadio radio=(HtmlSelectOneRadio)value.getParent();
radioValue = (String)radio.getSubmittedValue();
System.out.println(radioValue);
if(radioValue.equalsIgnoreCase("percent")) {
financialDetailsBean.setName("kush");
}
if(radioValue.equals("share")) {
financialDetailsBean.setName("Nilesh");
}
System.out.println(financialDetailsBean.getName());
}
Here the main problem is my code is not getting updated, however event gets fired as system.out.println is printed in glassfish logs.
As far as i know, a4j support tag is used to rerender the div again based on id(using ajax).
But why value inside my div is not getting updated.
Please Help!!!