0

I have a radio button it's function is, when click it should reRender pageblock table. But when I press it button not get clicked. so that my table not get reRender. For achieving that i tried but not working. Please help me.

<apex:pageBlockTable id="cWapID" value="{!con_ord}" var="cWap" rendered="{!con_ord.size > 0}"> 
<apex:column headerValue="Select" styleClass="actionColumn">
    <apex:actionSupport event="onclick" action="{!onChangeContract}" reRender="cWapID, attachmentSection" status="waitMsg">
        <input type="radio" name="chosen" id="{!cWap.Id}" VALUE="{!cWap.Id}" onclick="setcontractId(this,'{!$Component.RadioButtonValue}');"/> 
    </apex:actionSupport>
 </apex:column> 
</apex:pageBlockTable>
 <apex:inputHidden value="{!selectedcontractId}" id="RadioButtonValue"/>   

  <script type="text/javascript">
      function setcontractId(input, textid) {
          document.getElementById(textid).value = input.value;
      }   
   </script> 

My Controller method:

public String selectedcontractId {get; set;} 
//On click of radio button change 
public PageReference onChangeContract(){  
    return null;
}

On Click radio button here i am getting selectedcontractId value as an Id.

  • Try wrapping your pageBlockTable in an outputPanel tag and then rerender the ID of the outputPanel. – Berg Jul 22 '15 at 11:05
1

All other things working correctly, your use of action support is incorrect. It needs to be the child of the mage it is supporting not the parent since you already have an onClick on the input you can remove the action support altogether

<apex:inputRadio name="chosen" id="{!cWap.Id}" VALUE="{!cWap.Id}"  
                 onclick="setcontractId(this,'{!$Component.RadioButtonValue}');"/> 

Also, javascript is CASE SENSITIVE so your function never gets called so change the onclick to this:

onclick="setcontractid(this,'{!$Component.RadioButtonValue}');"

To call the controller method, use action function and param

<apex:actionFunction name="setcontractid" action="{!onChangeContract}" rerender="">
   <apex:param value="" name="myparam" assignto="{!controllervariable}"/>
</apex:actionFunction>

and change your onClick to:

onclick="setcontractid(this.value);"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.