UPDATE
I have the following function:
<apex:actionFunction action="{!selectRec}" name="recordSelectFunction">
<apex:param name="selectedID" assignto="{!selectedRec}" value=""/>
</apex:actionFunction>
</apex:form>
And this, inside of an iterative block (where the iterated var record is "item".
<a style="cursor:pointer; font-size:14px" onclick="recordSelectFunction('{!item.Id}')">Select Record</a>
Based on documentation, expecting onclick to call that apex:actionFunction, which passes "item.id" as the parameter, meaning my controller var would be set to that ID. !selectRec in the controller simply prints out the variable to start, and it's null.
I would like a button to be clicked and use param to set a certain variable in the controller to a value from the VF page. I am hoping someone can either tell me why it's not possible, or (hopefully) how to correctly develop this. See bottom for link to the StackExchange question that got me started.
I have a block table that loops over a list of records from the controller, and I output things like a date field, ID, Name, etc. and the last thing I do it add the following button:
<apex:form>
<apex:commandButton value="Select Record" action="{!selectRecord}">
<apex:param name="recordID" assignto="{!selectedRec}" value="{!item.ID}"/>
// "item" is the iterated var
</apex:commandButton>
</apex:form>
the goal is for that button to call a function
public pageReference selectRecord(){
system.debug('the record ID is : ' + selectedRec);
return null;
}