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
SRILAKSHMI BSRILAKSHMI B 

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="{!apw.id}" name="radioid"/>
</apex:actionSupport>
</input>
</apex:column>   
<apex:column value="{!apw.name}" headerValue="Partcipant Name"/>
<apex:column value="{!apw.Subject}" headerValue="Subject"/>
<apex:column value="{!apw.status}" headerValue="Status"/>

</apex:pageBlockTable>

 

Thanks,

Srilakshmi B

bob_buzzardbob_buzzard

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:

 

http://bobbuzzard.blogspot.co.uk/2011/07/passing-parameters-to-apex-method-from.html

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="" />
        </apex:actionFunction>

 

and in your controller

 

    public string paramValueFromPage{get;set{
            paramValueFromPage=value;      
     }
    }

 

Please mark this as solved if above is what you need

SRILAKSHMI BSRILAKSHMI B

Hi,

 

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.

 

Thanks,

Srilakshmi B

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