You need to sign in to do that
Don't have an account?

Identifying the button clicked before calling the action method
Hi All,
Is there any way we can tell from the Controller Extension which button in clicked in the Visualforce Page.
For example in the visualforce page Below:
Can we check from the controller extension AccountExt ,which button was clicked by the user.
Thanks
Saurabh
.
Thanks
Saurabh Agrahari
Is there any way we can tell from the Controller Extension which button in clicked in the Visualforce Page.
For example in the visualforce page Below:
<apex:page standardController="Account" extensions="AccountExt" > <apex:form> <apex:commandButton value="X" action="{!X_AccountExt}"/> <apex:commandButton value="Y" action="{!Y_AccountExt}"/> </apex:form> </apex:page>
Can we check from the controller extension AccountExt ,which button was clicked by the user.
Thanks
Saurabh
.
Thanks
Saurabh Agrahari
From the method call you would understand anyway what was the button being cliked..
X_AccountExt() method being called 'X' button clicked and same for 'Y'
But let me re-phrase the question ,so that you understand better,
Suppose I modify the visualforce page posted above
Now this js_function invokes a method in the extension say XY();
So now how can I from XY() method call X_AccountExt() or Y_AccountExt() action method based on which button the user clicked.
Thanks
Saurabh
<apex:commandButton value="X" action="{!X_AccountExt}" onclick="js_function(this)"/>
Pass button instance to JS method call and pass to the method in your controller. Hope this would help you.
This seems to me a good solution .But for some reason I am not able to get the value in the controller.
I am trying to pass a parameter to the Controller Extension through java script using apex:actionfunction and
apex:param
The visualforce page and controller code is given below: Apex Code:
Not sure what I am missing.
Like this
<apex:param name="nameVal" value="{!X}" assignTo="{!abc}" id="xyzbtn" />
and Incntroller
you must have
public String abc {get;set}
in controller user abc values as parameter value as needed
Apologies for late reply .I have tried this before many times but could not get this working.
Earlier I have tried something like below:
Could you please explain what do you mean by 'must have to be re-rerendered '.May be I am not rendereing properly that 's why getting null value;
Thanks
Saurabh