I have a visual force page. I have two values on this page that I need to pass to its controller. I am able to put these values in hidden fields on the page. I am now trying to use an apex:actionFunction to send them over to the controller.
Here is my relevant section of the VF Page.
<apex:actionFunction name="passStringToController" immediate="true" action="{!saveCaseRecord}" rerender="">
<apex:param name="p1" value="{!Case.Type}" assignTo="{!CaseType}" />
<apex:param name="p2" value="{!Case.Case_Type_Details__c}" assignTo="{!CaseSubType}" />
</apex:actionFunction>
Here is the relevant section of the apex controller code. Edited: The CaseType and CaseSubType variables have been declared as public in the controller.
public string CaseType {get;set;}
public string CaseSubType {get;set;}
public PageReference saveCaseRecord()
{
System.Debug('BeforE calling createCase');
System.Debug('CaseType ' + CaseType);
System.Debug('CaseSubType ' + CaseSubType);
}
I am definitely missing a piece here, because I am getting a null each time in the controller. I wrote a javascript function, but I don't believe it is firing. I am never seeing this value in the console log.
function passStringToController()
{
console.log('Function to get controller - passStringToController');
};
I am calling the javascript passStringToController() from another javascript method on the same page.