I have an actionfunction called from JavaScript


I have the actionFunction tag:

         <apex:form id="content" >

              <apex:actionfunction name="attach_file" action="{!AttachFile}" reRender="">
                  <apex:param name="inputparam" value="" /> 


and in the controller i am waiting for the parameter, but i get 'null'

public pagereference AttachFile(){
        String input_param = Apexpages.currentPage().getParameters().get('inputparam');


      return null;

I have tried reRendering to none, # and it still does not work, I have tried displaying all the parameters received in the debug log and the 'inputparam' does not appear at all. I've tried setting the value to a global variable in the controller and it sets to null.

Any suggestions will be appreciated. Thank you


I have had mixed luck doing it like that (probably my own fault). However I know this works (string values):

public string paramValue {get;set;}

public pagereference AttachFile(){


      return null;

and the page

<apex:actionfunction name="attach_file" action="{!AttachFile}" reRender="">
                  <apex:param name="inputparam" value="" assignTo="{!paramValue}"/> 

Update: Complete Example


public class myExample{

    public string paramValue {get;set;}
    public void debugValue(){



<apex:page controller="myExample">


    function callmethod(){


    <apex:form >
        <apex:actionFunction name="doit" action="{!debugValue}" rerender="">
            <apex:param value="" name="exampleParam" assignTo="{!paramValue}"/>
        <button onclick="callmethod(); return false;">Click Me</button>



13:27:43.0 (407024)|CODE_UNIT_STARTED|[EXTERNAL]|066290000008kMK|VF: /apex/myexample 13:27:43.0 (1192401)|VF_DESERIALIZE_VIEWSTATE_BEGIN|066290000008kMK


13:27:43.0 (8326868)|SYSTEM_MODE_ENTER|true

13:27:43.0 (9547780)|USER_DEBUG|[7]|DEBUG|test_value

So start from here and add your own code till it breaks. Then you will know what went wrong

  • I tried doing that and it still does not work =( Sep 12 '16 at 17:23
  • 1
    @LourdesMontero - Updated with SSCCE (sscce.org)
    – Eric
    Sep 12 '16 at 17:30
  • I did what you said, and got the problem, i was using inputFile in the same form. Sep 12 '16 at 18:17

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.