1

I click on the buttom (a commandlink), which calls the js function save() and then calls the actionfunction afterValidation(), which is supposed to save the param value to the controller and then take you to the next page. It takes me to the next page fine, but the param value never gets passed

JS:

function save() {
  // validate everything is okay
  afterValidation();
}

VF:

<apex:form >
        <apex:commandLink styleClass="slds-button slds-button--brand" onclick="save();return false;">
        Next
          <svg aria-hidden="true" class="slds-button__icon slds-button__icon--right">
            <use xlink:href="{!URLFOR($Resource.lightning, '/assets/icons/utility-sprite/svg/symbols.svg#forward')}"></use>
          </svg>
        </apex:commandLink>    
        <apex:actionFunction name="afterValidation" action="{!next}">
          <apex:param name="test" value="abc" assignTo="{!test2}"/>
        </apex:actionFunction>
    </apex:form>

Controller:

public String test2 {get;set;}
public PageReference next() { // takes you to the next page...works as expected}

But every time I debug "test2", I get "null" instead of "abc"

1
  • wen do u get null in debug ? in your next method before moving to the next page ? or when you try accessing test2 in the next page methods ? Nov 29 '15 at 19:45
2

I think the reason is because your apex:Param is child of second actionFunction, rather than first one.

2

This is a weird known issue. You need to add a reRender attribute in your actionFunction tag to make apex:param work(sometimes).

<apex:actionFunction name="afterValidation" action="{!next}" reRender=""> 
<apex:param name="testParam" assignTo="{!test2}" value="abc" />
</apex:actionFunction>

You may want to vote this idea

1

Give the apex:param a "name" property. Any name. It's weird bug.

<apex:param name="test" value="abc" name="aaa" assignTo="{!test2}"/>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.