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

How to call two function from “action” attribute of command button

I have two function which needs to be called from one button. Currently I am doing this by creating two button one "Confirm" and another "Save". but I don't want two button I want only one button "Save", on click of Save first the method called by "Confirm" button should be called and then the method called by "Save" button.

Below is my code:
<apex:commandButton value="Confirm" action="{!save}"/>   
<apex:commandButton value="Save" action="javascript:top.window.opener.closeFunction()" ></apex:commandbutton>

Andy BoettcherAndy Boettcher
You could do this:
<apex:commandButton value="Save" action="{!save}" oncomplete="javascript:top.window.opener.closeFunction()" ></apex:commandbutton>

KEEP IN MIND that if you're accessing the {!save} of the standardController - that will return a PageReference and redirect the browser.  You will want to override the standard save method in your controller - call from there, and then return what you want to happen.
Nishad BashaNishad Basha
  Hi, Andy Boettcher
How to display the Account number in visualforce page?

for example  I have one SBI Account Number like : 1234 when iam click the search button that time  to display the 1234 Account details like that Account Name, Address,city.......etc.
How to solve above solution please give some ideas.
Nikitha V KumarNikitha V Kumar
If you have 2 apex methods to invoke, You could simply call second function from first function in your controller. Invoke only first function from your visualforce page.