I am trying to send the selected Id to the controller class from VF page and getting error inside the action function method :
Here I want to pass parameters to the controller
Error: may not be used within an iterable
component. You can use to define parameters for the
function and pass iteration-specific values via the parameters.
<apex:repeat value="{!Records}" var="item" >
//.................
//..................
<apex:pageBlock mode="edit " id="pb">
<apex:actionFunction action="{!deleteRecord}" name="deleteBtn" reRender="pb" >
<apex:param name="selectedId" value="" assignTo="{!deleteId}"/>
</apex:actionFunction>
//.................
//..................
</apex:pageBlock>
</apex:repeat>
Apex:
public String deleteId { get; set; }
public void deleteRecord()
{
system.debug('deleteId' + deleteId);
}
Best Answer
You need to move your action function outside your iteration block and call it via Javascript by passing the parameter.
So before your iteration put this:
And then inside your
apex:repeat
replace your current action function with: