You need to sign in to do that
Don't have an account?
Pass an argument in an action method
Hi,
I would like to know if it is possible to pass an argument in an action method.
I want to pass a concrete string when button is pushed.
My code is:
**APEX**
[...]
<apex:column value="{!a.phone}"/>
<!-- BOTON EN UNA COLUMNA NUEVA -->
<apex:column headerValue="ClickToCall">
<apex:form >
<apex:commandButton value="LLamar" action="{!clickToCall}"/>
</apex:form>
</apex:column>
[...]
--> I WANT TO DO SOMETHING LIKE THIS: clickToCall({!a.phone})
**CONTROLLER CLASS**
public PageReference clickToCall(String number)
{
*DO SOMETHING*...
}
You can't pass the argument to the action method itself, as those cannot take parameters. The way it works is that you supply the param as Shash has shown, and then by the time the action method is invoked, the associated controller property has been populated with the data.
I wrote a blog post on this at:
http://bobbuzzard.blogspot.com/2011/07/passing-parameters-to-apex-method-from.html
All Answers
Yes try this
let me know if any issues in it.
You can't pass the argument to the action method itself, as those cannot take parameters. The way it works is that you supply the param as Shash has shown, and then by the time the action method is invoked, the associated controller property has been populated with the data.
I wrote a blog post on this at:
http://bobbuzzard.blogspot.com/2011/07/passing-parameters-to-apex-method-from.html
It works, thx you so much :)