+ Start a Discussion
Abhijit ShrikhandeAbhijit Shrikhande 

VisualForce having an issue with apex:actionFunction

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}" />

Here is the relevant section of the apex controller code.
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 getting the alert on my view page.
function passStringToController()
        alert('We need to pass stuff from here');

you need to do use ApexPages.currentPage().getParameters().get('myParamName') to get the values of those variables.