I am trying to pass from my JS to my controller and in the console log, All the values appear correctly. When I check the controller they are all null.
I have looked it over 1000 Times. It could be a small mistake that I'm not seeing anymore because I've looked at it so much. Any direction would be great.
Here is my VF:
<apex:form>.....
HTML here.....
<apex:actionFunction name="SaveFunc" action="{!AutoSave}">
<apex:param name="Cid" value="" />
<apex:param name="Amount" value="" />
<apex:param name="Feed" value="" />
</apex:actionFunction>
</apex:form>
<script>
function Asave(Cid, Eid){
console.log(Cid);
console.log(Eid);
SaveFunc(
Cid,
document.getElementById(Eid).value,
'Blank'
);
}
function Fsave(Cid, Eid){
SaveFunc(
Cid,
'Blank',
document.getElementById(Eid).value
);
}
</script>
Here is the code from my controller:
public PageReference AutoSave(){
string CMid = Apexpages.currentPage().getParameters().get('Cid');
string Amount = Apexpages.currentPage().getParameters().get('Amount');
String Feedback = Apexpages.currentPage().getParameters().get('Feed');
system.debug(CMid);
system.debug(Amount);
system.debug(FeedBack);
CampaignMember c = New Campaignmember();
c.id = CMid;
if(Amount != 'Blank'){
c.Call_Debit__c = decimal.valueOf(Amount);
update c;}
if(Feedback != 'Blank'){
c.Feedback__c = Feedback;
update c;
}
return null;
}
Thanks in advanced.
SaveFunc
generated in your page it is missing any parameters, you could try this work-around laceysnr.com/2010/11/…. The pattern you are using is not something I've ever tried or seen so there may be other problems.