function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brad HuffmanBrad Huffman 

Passing parameters in the action attribute of an apex:actionSupport

I have an Apex class with a method that accepts a single integer as a parameter.  I'd like to be able to call the method as the action attribute of an Apex:actionSupport, but I'm getting an error indicating that the method is unknown.  If I remove the parameter from the method definition, everything works as expected (minus the fact that my method doesn't do what it's supposed to do).  Does actionSupport not support passing parameters to the specified action?
XactiumBenXactiumBen
I think you can put parameters into your controller by using the param apex tag within your actionSupport:

Code:
<apex:actionSupport event="onclick" action="{!dothis}">
<apex:param name="testParam" value="randomValue" assignTo="{!myParam}" />
</apex:actionSupport>

 
I know I've done this using an actionFunction but it should work for actionSupport.  {!myParam} is a setter method in your controller.  Not sure if it passes in the parameters before the action or after, you'll probably have to experiment.
Brad HuffmanBrad Huffman
Thanks for the reply.  We worked it out yesterday.  Shoulda mentioned that.  :) 
XactiumBenXactiumBen
Fair enough.  Did you solve it the way I mentioned or did you find an alternate solution?
Brad HuffmanBrad Huffman
Ben,

Solved it essentially the way you mentioned.  Thx again.

Brad