Skip to main content
6 votes
Accepted

Passing Parameters Commandbutton

Need to be add a DummyID for reRedner. <apex:page controller="clicktest"> <apex:form> <apex:commandButton action="{!Stats_In}" value="click" reRender="dummyId"> <...
NITHESH K's user avatar
  • 2,545
6 votes
Accepted

put an image in a command button

You can store the required image in static resource and use it in command button in the following way <apex:commandbutton image="{!URLFOR($Resource.Required_Image)}" id="SaveChanges" reRender="...
Sukesh Kumar's user avatar
6 votes
Accepted

How to disable a apex command button

You should set the btnDisabled class name, as well as setting "disabled". Here's a live example for you to use: <apex:page standardStylesheets="true" lightningStylesheets="false" showHeader="true" ...
sfdcfox's user avatar
  • 502k
5 votes
Accepted

How to call apex method from command button on custom visualforce page

You can't specify parameters as you would when calling a method directly from Apex Code. Instead, you have to use apex:param, as shown here: <apex:commandButton action="{!sendEmail}" value="Send ...
sfdcfox's user avatar
  • 502k
5 votes
Accepted

Embedded VF page's refresh issue

No, that's expected. In fact, this probably shouldn't work at all, because you're prematurely cancelling the actionFunction (it's asynchronous). What you end up with is a situation that's a race ...
sfdcfox's user avatar
  • 502k
5 votes

How can I get this button to pass data to controller?

Take a look at the apex:actionFunction. This allows you to generate a JavaScript function and to call this function from JavaScript in your page (e.g. in an onclick event). The parameters to the ...
Phil W's user avatar
  • 38.1k
4 votes
Accepted

Align a command button using float:center style

There's no such CSS value for "float" of "center." If you want your commandButton to be in the middle of the area, you should do something like this: <div style="text-align: center"> <...
sfdcfox's user avatar
  • 502k
4 votes
Accepted

Unintended Page refresh command button inside form

use reRender attribute on apex:commandButton here is a nice article Implementing Partial Page Updates with Command Links and Buttons where all required steps are listed First, create or identify the ...
Oleksandr Berehovskyi's user avatar
3 votes
Accepted

Only allow one submission with apex CommandButton

I am assuming that your apex:commandbutton is within an apex:form, note that an apex:commandbutton reders to: <input id="thePage:theForm:theButton" type="submit" name="thePage:theForm:theButton" ...
glls's user avatar
  • 20.3k
3 votes

System.QueryException: unexpected token: = Error is in expression '{!dosearch}' in component

you have problem with string query. Do not use string for SOQL query, until you have to do it, because dynamic SOQL is vulnerable to SOQL Injections. There are two ways to prevent possible SOQL ...
Oleksandr Berehovskyi's user avatar
3 votes
Accepted

Using action and onclick together on command button

If you want to abort the action, return a value. If you do not want to abort the action, do not return a value. Example: <apex:commandButton value="Do Something" onclick="if(!...
sfdcfox's user avatar
  • 502k
3 votes
Accepted

Making a command button open in new tab

You can try with a CommandLink as: <apex:commandLink target="_blank" styleClass="btn" style="text-decoration:none;padding:4px;" action="https://c.eu6.visual.force.com/apex/AmountSpent2?core....
C. Praveenkumar's user avatar
3 votes

Is there a apex command button that allows you to not refresh the page?

Ok, there are a couple of things going on here: When you include merge syntax in javascript they do not get updated when the properties in the controller get updated unless you rerender them. When I ...
Eric's user avatar
  • 54.4k
3 votes
Accepted

CommandButton oncomplete JS function not firing

The following works in my testing: <apex:commandButton value="Reject (Entry Criteria)" onclick="if(!confirm('Are you sure?')){return false};" action="{!debugSomething}" oncomplete="refreshPage();"...
Eric's user avatar
  • 54.4k
3 votes
Accepted

How to detect which command button is clicked?

You can pass the parameter in the Javascript function and then check the value for both the case. For example Pass Save from the save button and pass SaveAndNew from save and new button. Below will ...
Amit Singh's user avatar
3 votes
Accepted

Visualforce CommandButton Open in Existing Window

Add target to the parent tag, as you can see the following code i have added to the <apex:form>, i have tested and it's working <apex:page standardController="Account" > <apex:form ...
Narendra Nimmana's user avatar
3 votes

Displaying a list returned from a method on a Visualforce page

Apex is a case-insensitive language. The identifiers pgm and PGM are the same as far as the compiler is concerned. In addition, there is a key logical error in the code populating this variable. Let's ...
David Reed's user avatar
  • 93.6k
3 votes
Accepted

How to include Find Duplicates standard button in visualforce page

As per VF developer guide it would be FindDup <apex:commandButton action="{!URLFOR($Action.Lead.FindDup, Lead.Id, null, true)}" value="FindDup" />
Pranay Jaiswal's user avatar
3 votes

Lightning cancel button in visualforce page

Method - Using html-5 in doctype in visualforce page means you should use html-formnovalidate and immediate in cancel button. For example <apex:commandButton action="{!cancel}" value="Cancel" ...
Sahil Malhotra's user avatar
2 votes
Accepted

How to create New custom button of Quote for create New Quote Using URL Hack

You can not leave Opportunity as a blank just because of both object have Master-Detail Relationship. Alternate solution is : Create one Visualforce and set that page in your new Custom button ...
Nihar's user avatar
  • 1,182
2 votes

URL hack is not working for Standard Quote Object Using custom button (Visualforce page)

We have to provide the Id of the Opportunity since Opportunity and Quote is a Master-detail relationship. We cannot make the opportunity to be blank.
Nihar's user avatar
  • 1,182
2 votes
Accepted

Posting data to a controller extension method

In your controller, you need a class method that returns a PageReference in order to associate it to the commandButton. You'll also want to have some class variables to bind the input fields to: ...
IllusiveBrian's user avatar
2 votes

Posting data to a controller extension method

Unless you are using JS remoting you need to use class properties: public string activationId {get; set;} public string userName {get; set;} public string password {get; set;} public static Boolean ...
Eric's user avatar
  • 54.4k
2 votes
Accepted

Is there a way to hide the "Save And Submit" button after the record is saved?

All you need to do is rerender the buttonPanel since you already have a flag to indicate it has been saved. Ensure you have set inSubmissionProcess to true in your controller or add a new flag to ...
Eric's user avatar
  • 54.4k
2 votes

Passing Parameters Commandbutton

Just add a dummy panel and reRender it. It will work. <apex:outputPanel id="panel2"> </apex:outputPanel> <apex:commandButton action="{!Stats_In}" value="click" reRender="panel2"> ...
Rohit Mourya's user avatar
  • 3,891
2 votes

Only allow one submission with apex CommandButton

You need validateChecked() to return true or false so that you can control the behavior of the onclick="" function call on the commandbutton. onclick="validateChecked()" should be adjusted like this ...
Mark Pond's user avatar
  • 23.1k
2 votes
Accepted

Apex Controller Variable value Not Passing to Javascript function

If you Javascript is outside of your rerender target, then the value won't be refreshed on completion of your server call. Move the <script> tag inside the form to ensure that it gets ...
Caspar Harmer's user avatar
2 votes
Accepted

Hide custom button on visualforce page

You can use rendered attribute in apex:commandButton like below: <apex:commandButton value="Confirm" action="{!Confirm}" rendered="{!ishide}"/> Modified the class like below by using an extra ...
Subhasis Kar's user avatar
2 votes

How to disable a apex command button

You're not missing anything, it's enough to specify the attribute on the element. You don't explicitly need to set a value (true/false). As long as the attribute is present, the element will be ...
Boris Bachovski's user avatar
2 votes

Style and Show command Link as Command Button in Classic & Lightning

For Lightning you can use following styleClass attribute: styleClass="slds-m-top_xx-small slds-button slds-button_neutral btnSubmit" i.e., <apex:commandLink target="_top" ...
Chirag Mehta's user avatar
  • 1,261

Only top scored, non community-wiki answers of a minimum length are eligible