6 votes
Accepted

How to avoid hardcoding Visualforce Page names in PageReferences?

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

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

try action="{!quickSave}" Standard Controller action
user avatar
  • 3,044
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'); ...
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="...
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" ...
user avatar
  • 433k
5 votes
Accepted

pressing enter on inputText does not trigger commandButton

Catch the enter-key at your inputText with the onkeypress-handler and trigger a fake-click on the button: <script> function handlerKeyPress(ev) { if (window.event && window....
user avatar
  • 33.6k
5 votes
Accepted

commandbutton not running action function after reRender

Pretty sure it is related to this issue/bug re Command Buttons and Action Regions. I just tried a short version of your code with the button wrapped in an actionregion, and it then worked for me.
user avatar
5 votes

How to return to the previous page from a Visualforce page?

Why not using JavaScript? Either you can store the previous URL in localStorage and go back there later with document.location or try simply to use window.history.back() http://www.w3schools.com/...
user avatar
  • 33.6k
5 votes
Accepted

How do I generate 2 different documents from the same VisualForce page?

You can accomplish this with two buttons and the addition of a second parameter to the URL for the GrantDoc VF page. I would suggest using the ISO 639 language code to keep the language values ...
user avatar
  • 22.3k
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" ...
user avatar
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"....
user avatar
  • 2,101
5 votes
Accepted

CommandButton with JavaScript and controller method

Make the variable "doc" static to avoid view state error
user avatar
  • 2,146
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 ...
user avatar
  • 433k
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 ...
user avatar
  • 433k
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 ...
user avatar
  • 27.3k
4 votes
Accepted

Javascript action function not working after Summer 14 release

This is how you would make sure you are using jQuery (in this case taken from a CDN location): <apex:includeScript value="https://code.jquery.com/jquery-1.11.0.min.js"/> <script> var j$ = ...
user avatar
  • 130k
4 votes
Accepted

Same apex method different output

Even though you only have 1 SOQL statement in your code it gets executed 3 times, once for every call to Count(). If you use a map where the key is the status and the value is the count you can do ...
user avatar
  • 12.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}"
user avatar
  • 10.3k
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.
user avatar
  • 490
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/...
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"> <...
user avatar
  • 433k
4 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"> <...
user avatar
  • 2,444
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 ...
user avatar
3 votes
Accepted

Need to click two times on <apex:commandButton> to call action

add a rerender="msgs" to the tag. Then you can also add an <apex:pageMessages id="msgs"> to the page as well
user avatar
  • 53.1k
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 ...
user avatar
3 votes
Accepted

Values don't update after I call action on a commandbutton?

The problem is because GetCount is only called when the page loads and never called again when the button is pressed. You could change followingCount to the code below so that the SOQL gets re-queried ...
user avatar
  • 12.1k
3 votes
Accepted

How to trigger an apex:actionFuction from an apex:commandButton without a page refresh?

<apex:commandButton value="Do something" onclick="actionFunction(); return false;" /> <apex:actionFunction name="actionFunction" action="{!action}" rerender="someArea" />
user avatar
  • 433k
3 votes
Accepted

Custom buttons to ask for data

Unfortunately, using a standard custom button, this isn't possible. You may be able to do some tricks by creating a button with Content Source set to Visualforce and then executing some Javascript as ...
user avatar
  • 19.5k
3 votes
Accepted

What is immediate="true" translated into html

There's no direct translation for the immediate attribute, because it only affects server-side validation. In essence, this attribute is evaluated early in the Visualforce transaction lifecycle, ...
user avatar
  • 433k
3 votes
Accepted

CommandButton reRender causing action to fire twice

Sounds similar to an issue I faced - there are a couple of answers worth trying, but I think it is using the status with a PageBlockButton that seems to cause the issue...if you take it out of the ...
user avatar

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