apex:actionFunction not passing the parameters

I am currently 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.

ActionFunction

<apex:actionFunction name="Sign_Up" action="{!SignUp}">
<apex:param id="deliveryId_signup" name="deliveryId_signup" value="" assignTo="{!deliveryId}"/>
<apex:param id="slotType_signup" name="slotType_signup" value="" assignTo="{!slotType}"/>
</apex:actionFunction>


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 delivery\nError: ' + e.getMessage() + '\tLine: ' + e.getLineNumber() + '\t' + e.getCause() + '\t' + e.getStackTraceString();
}

return null;
}


Any help trying to understand why are the fields not being populated on the controller function would be great!

• Is it getting assigned to deliveryId and slotType? Also as I can remember there was one issue where you had to rerender a dom element on the action function to get it working. Not sure it is still the case. May be set rerender attribute on actionfucntion to a dom element and see whether it works! – Ranga Jun 20 '18 at 16:29
• Yes @Ranga, I have checked using Developer Tools and it seems that the deliveryId and SlotType are being assigned in the page. I am now putting the re-render tags and it is now passing the variables. Thanks! – Joao Batista Jun 22 '18 at 8:29
• I've added it as an answer for future reference. Thanks! – Ranga Jun 22 '18 at 14:17

Action function is required to have rerender attribute set so that it posts payload back to server. So something like this should work.
<apex:actionFunction name="Sign_Up" action="{!SignUp}" rerender="bob">