function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to pass the record value from VF page to controller upon clicking the radiobutton.

Hi All,


I am using radio button in data table in my Visualforce page.I am using wrapper class for this in controller.

When user selects the radi button i want to assign record id value to one of the variable in controller .


Below is the code which is not working.Please suggest what modification required here.If i use 'onclick' event that will refresh the page  which should not happen.


<apex:pageBlockTable value="{!accountlist}" var="apw" >
<apex:column >
<input type="radio"  value="true" name="r">
<apex:actionSupport event="onsubmit">
 <apex:param value="{!}" name="radioid"/>
<apex:column value="{!}" headerValue="Partcipant Name"/>
<apex:column value="{!apw.Subject}" headerValue="Subject"/>
<apex:column value="{!apw.status}" headerValue="Status"/>




Srilakshmi B


I'd use an apex:inputradio rather than a regular HTML.  That way, if you back if by a controller variable, the value will be updated in the controller when you submit the form.


I've explained this in more detail with a lists example that looks to be a fairly close fit to what you are trying to achieve:

Abhay AroraAbhay Arora

Bascially you can use any <apex:input tag along with a onChnage event and pass your value to a controller in below manner


 <apex:selectlist  value="{!val}" onChange="updatePanel('{!passMeToContrl}')"   size="1">


        <apex:actionFunction name="updatePanel"
            action="{!handelParaCTRl}" reRender="panel">
            <apex:param name="param2passName" assignTo="{!paramValueFromPage}"           value="" />


and in your controller


    public string paramValueFromPage{get;set{


Please mark this as solved if above is what you need




Thanks for the reply.But still  i am unable to resolve the issue.I saw the link which you have specified.

If I have to use  param inside command button, the command button will be outside the datatable and here I cannot access the datatable looping variable.


Please could you post small code snippet to acheive this.



Srilakshmi B

ying liuying liu
Are there any solutions now?I met the same issue. Help me.
The same issue here, more than years and yet to resolve. Really need a solution for this.