6 votes

How to avoid hardcoding Visualforce Page names in PageReferences?

I think you should use an explicit reference so it doesn't break while packaging: PageReference p = Page.TheVisualforcePage; p.getParameters().put('id', caseId); Daniel Ballinger has an excellent ...
manjit5190's user avatar
  • 7,973
6 votes
Accepted

How to avoid page reload on standardController standard action (Save)?

try action="{!quickSave}" Standard Controller action
o-lexi's user avatar
  • 3,094
6 votes
Accepted

how to call another visualforce page from an apex command button

Put the below code in the controller action method that is being called on click of command button PageReference pr = new PageReference('/apex/yourVFPageName'); pr.getParameters().put('key','value'); ...
Saumya Ranjan Satapathy's user avatar
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
  • 481k
5 votes
Accepted

Used html button instead of apex command button,controller action not updating new values?why

Values from your page are sent to a controller on form submit. You can see this if you view HTML code generated by your visualforce page <apex:commandButton/> will be an input with type="submit"....
Oles Malkov's user avatar
  • 2,161
5 votes
Accepted

CommandButton with JavaScript and controller method

Make the variable "doc" static to avoid view state error
Anurag's user avatar
  • 2,206
5 votes
Accepted

apex:commandButton updated by apex:actionFunction

One way use action status. Display loading symbol unit your process is not completed. <apex:actionFunction action="{!startRequest}" name="startRequest_JS" ...
Ratan Paul's user avatar
  • 22.5k
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
  • 481k
5 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,515
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
  • 481k
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
  • 34.1k
4 votes

Button Render depending on a boolean value

Your first condition is wrong if you are doing NOT in your condition correct syntax is rendered="{!!hasuser}"
Himanshu's user avatar
  • 10.5k
4 votes
Accepted

commandbutton on a vf page inside a section

Change your javascript function name from new() to something else say new_method() as new is a keyword. It will work.
s_saiyan's user avatar
  • 510
4 votes
Accepted

Make a button on visualforce update the records in an object

If these are all fields that live directly on your custom object, then you can just use the standard controller on your custom object, and then invoke the standard {!save} function on a commandButton/...
Morgan Marchese's user avatar
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
  • 481k
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

How does default command button of VF page work?

Visualforce does not allow you to change the default command button. It would in fact be difficult, because the default behavior comes from the browser. In most browsers, if enter is pressed while ...
Jason Clark's user avatar
  • 11.8k
3 votes
Accepted

Problem in reRender of <apex:detail> tag on click of commandbutton

It's look like inlineEdit couldn't be binded with dynamic boolean. Try to create two detail and render them accordingly: <apex:tab label="Details" name="AccDetails" id="tabdetails"> <...
Ilya Lepesh's user avatar
  • 4,115
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
  • 54k
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
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
  • 481k
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

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
  • 20k
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
  • 54k
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
  • 92.1k
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

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