About this question
I was trying to call an Apex controller function from an apex:actionFunction, but I can't seem to get the parameters to be passed to the controller function. How can I pass parameters in apex:actionfunction? bActionFunction Button
<button type="button" class="btn btn-primary btn-block" onclick="Sign_Up('{! deliveriesDateMap[date][school][delivery].delivery.Id }','Signed Off');"> Sign Up </button>
Apex Function public String deliveryId { get; set; } public String slotType { get; set; } public PageReference SignUp() { //I have tried to also get the params using the options below, but no success String passedParam1 = Apexpages.currentPage().getParameters().get('deliveryId_signup'); System.debug(passedParam1); String passedParam2 = System.CurrentPageReference().getParameters().get('deliveryId_signup'); System.debug(passedParam2); try{ Contact c = [SELECT Id FROM Contact WHERE Id =:contactId]; Delivery__c d = deliveriesMap.get(deliveryId); Attendance_Slot__c slot = new Attendance_Slot__c ( Delivery__c = deliveryId, Type__c = slotType, Contact__c = c.Id ); insert slot; successMessage = 'You have successfully signed up for the delivery'; } catch(Exception e) { errorMessage = 'There was an error signing you up for the deliverynError: ' + e.getMessage() + 'tLine: ' + e.getLineNumber() + 't' + e.getCause() + 't' + e.getStackTraceString(); } return null; }Don’t know why the apex:actionfunction not passing the parameters to the controller function. Any help trying to understand why are the fields not being populated on the controller function would be great!