Questions tagged [commandbutton]

A button that is rendered as an HTML input element with the type attribute set to submit, reset, or image, depending on the <apex:commandButton> tag's specified values. The button executes an action defined by a controller, and then either refreshes the current page, or navigates to a different page based on the PageReference variable that is returned by the action.

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

CommandButton action fails when selectList is populated

I have a visualforce page where I have a form with 4 separate selectLists with options populated based on different user groups. So far so good. This form also has a submit button which triggers a ...
0
votes
1answer
426 views

Visualforce button to open EmailTemplate preview in new page causes error

I have a Visualforce page where I allow a user to edit text to add to a VF template and then send it. (I can't use an HTML template as there is an attachment which is built up using data from the ...
0
votes
1answer
389 views

Call Apex method from javascript on VF page via script tag

I'm trying to add an on-click for my apex:commandButton and what I want to do is call an Apex function from there. Essentially, I want to check if the the Apex function is true then I want to perform ...
0
votes
0answers
36 views

Change checked custom fields from two different list

i really need your help. Im actually a beginner in dev so maybe you can tell me whats wrong with my code. I have to make two list of Accounts, each account have a custom field named "Nivel__C" (...
0
votes
2answers
851 views

Render in Command Button

I have a question on how to use render on command button? <apex:pageBlockButtons > <apex:commandButton onclick="appendSelected(); return false;" value="Select" /> <apex:...
1
vote
1answer
22 views

Wrapper class data is not showing up in pageblock table after commandbutton action

Im having trouble getting a list from my wrapper class to show up in a page block table after clicking a command button. Can someone tell why my wrapper class is not showing up in the table? Is the ...
0
votes
2answers
32 views

Lightning cancel button in visualforce page

When cancel button is clicked in visualforce page, it has to redirect to home page.Instead I'm getting the same visualforce page.Kindly help. public PageReference cancel() { return null; }
3
votes
1answer
568 views

apex:repeat failing to rerender

I'm trying to reRender an apex:repeat tag to display items from a list on the click of a button. <apex:outputPanel layout="block" id="repeat_panel" > <apex:repeat value="{!messages}" var=...
0
votes
2answers
892 views

How to show/hide a commandButton or inputField or outputField in a custom visualforce page from a custom controller?

There is a custom visualforce page with a bunch of fields and a save button at the bottom. If the URL is bad/incorrect, I would like to hide the fields and the button on the page and display a ...
0
votes
4answers
5k views

Making a command button open in new tab

How do I make this open in a new tab: <apex:pageBlockSection > <apex:commandButton value="...
3
votes
1answer
712 views

Cancel button and immediate=true not working

I have a inline VF page where i show child records of the object. The child records are rendered in a apex:pageblock table. I am using apex:inlineeditsupport to enable inline editing of the fields for ...
0
votes
1answer
403 views

commandbutton does not execute the action

i have this code <apex:commandButton value="Valider Le BP" action="{!ValiderBP}" disabled="{!item.BP.Statut__c =='Validé'}" rerender="leblock1"> <apex:param name="BPid" value="{!item....
0
votes
0answers
19 views

OnChange input picklist field page message is not showing

I am writing a VF page where my requirement is that I have a input picklist field. When I change the picklist value it is calling to controller method. And when in controller I have written a page ...
0
votes
1answer
43 views

Visualforce CommandButton Auto-Refresh Parent Standard Page on Page Save

I have a Visualforce (child page) stored within a Standard Page layout (Opportunity parent standard page) which calls a custom controller "Save" method. I would like for the parent page to refresh/...
0
votes
2answers
42 views

How to pass a param from command button to controller?

I am not sure what is wrong with my code, but I get a null as a value in the controller, once I click the button. I read a lot, and I think I am using the right tags, but still not working. VF Page: ...
0
votes
1answer
33 views

How to check which command button is clicked in apex

I have 1 command button and 1 command link which are calling same method "testGet" in action. How we can check which button is clicked in apex method? With command link, I am passing param which is ...
0
votes
1answer
29 views

Method updates all records inside <list> - should update only 1

I have implemented the following visualforce page on the lead layout: Here is the code: .hmk_top5table{ color:black; width:99%; font-family:Arial, Helvetica, sans-...
0
votes
0answers
10 views

Skip VF page Validation in the table with multiple rows and editable required Fields

I'm working in a VF page where we display the list of accounts in table format with 10 rows per page and rows with edit mode. (i.e) Required fields in all the rows are in edit mode. when calling the ...
1
vote
1answer
85 views

Updating Custom Object using Visualforce

I am trying to update fields on a custom object using visualforce. I have embedded a visualforce page on Lead Layout that displays records of my custom object linked to the lead. I want to update ...
0
votes
1answer
28 views

How to include Find Duplicates standard button in visualforce page

I have a requirement to me include standard find duplicates button in the visualforce page like standard save & delete buttons. I have no clue either we need to create a custom button or there ...
0
votes
1answer
28 views

Displaying a list returned from a method on a Visualforce page

I've tried various iterations but this is what I have right now. This is the main code from VF Page: <div> <h3>Search Groups</h3> ...
0
votes
2answers
59 views

StandardSetController- the save and next don't work together but work as separate button clicks

I am using StandardSetController of the type QueryLocator for my solution. When I try to merge Save and Next together on Next button with Save being on action and next being on oncomplete JavaScript(...
0
votes
2answers
1k views

Hide custom button on visualforce page [duplicate]

I have a requirement to hide custom button when condition is satisfied.On case I have person_role field.If the field is null then I need to hide custom button on vf page. <apex:commandButton value=...
0
votes
0answers
28 views

How to Print attachment on a Salesforce site?

I have a Salesforce.com site where there is a button to open a div containing a iframe for a attachment. I'm able to show the attachment but not able to print the attachment using a custon button. We ...
0
votes
0answers
19 views

How to edit an element on a PageblockTable via Button

I have a list of products with their prices and I would like to be able to apply discounts to each product, but I'm not able to get the discount and the row number when clicking the button. I get an ...
1
vote
2answers
126 views

Command button value with special characters

I have command button. I want display the button value as below : View the "Requested Items" Chart So i have tried. <apex:commandButton style="background:#d0a416; font-weight: bold;float: right; ...
0
votes
1answer
21 views

How do I cancel a 'window.open' from a commandbutton?

I have the following CommandButton: <apex:commandButton value="View Statement" action="{!openInvestmentStatement}" title="View Statement" oncomplete="window....
6
votes
3answers
4k views

How to show/hide pageblock based on clicking a button in Visualforce using a standard controller?

Here i have one Visualforce page and my situation is when i am clicking on Save Button both PageBlock will appearing but i want is : when i am click on Save the existing Pageblock should be hide and ...
1
vote
1answer
41 views

Command Button not saving!

The command button on my Visualforce page is not saving edits to the record. Any help is appreciated! Visualforce Pg: <apex:page action="{!redirectToPartnerships}" extensions="EditExtensions" ...
1
vote
3answers
150 views

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

UPDATE I have the following function: <apex:actionFunction action="{!selectRec}" name="recordSelectFunction"> <apex:param name="selectedID" assignto="{!selectedRec}" ...
1
vote
1answer
57 views

Apex command button does not work with Apex Repeat on Transient Varriable?

I am running into a strange issue, I've created the following function in my visualforce controller for testing: public void willFail() { Account acc = null; acc.Name = 'test'; update acc;...
1
vote
3answers
14k views

how to call another visualforce page from an apex command button

I have an Apex command button in my Visual Force page. Using that button I want to call another visual force page, which in turn should call action function written in the controller. Please advise.
2
votes
2answers
238 views

Javascript button visibility depending on a variable

I have the following piece of code <td width="10%"/> <td width="80%"><input type="checkbox" name="checkbox-mini-1" id="checkbox-mini-1" data-mini="true" onclick="javascript: ...
1
vote
1answer
929 views

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

I would like a command link to look like a command button. I was once told that I could to that with using the style.
0
votes
0answers
128 views

How to download the excel from visual force page?

I have uploaded CSV file in visualforce page,When i click on the Download button then download the excel file,this is actual scenario,But here button also downloading along with excel file,How to ...
0
votes
1answer
143 views

Command button in Salesforce is not working on first click

I have written one logic in that when we select an object and its related fields on VF page and click on a Add Mapping Button,it will redirect to an other page where selected object and its fields ...
0
votes
1answer
86 views

How do I code a 'confirm send' button on my VisualForce page?

I have the following commandButton which runs the javascript function 'sendEmails'. This runs an ApexFunction which runs apex code to create and send an email from the controller. I need to add in a '...
0
votes
1answer
401 views

Unintended Page refresh command button inside form

I have an apex command button inside apex form with it's action calling an apex pagereference method. This makes the page reload every time I click the button. Can someone please help regarding this? ...
1
vote
0answers
228 views

How to redirect to a different page from popup window in visualforce

I am displaying a popup window on visualforce page. My use case is to redirect user to a entirely different visualforce page after user clicks Yes button on popup. Currently, It just stays on the ...
4
votes
3answers
3k views

Use jQuery to bind to apex:apex:commandButton onComplete event

Is it possible to bind to the onComplete event for an <apex:commandButton/>? Instead of using the following format: <script> function myOnComplete(){ // do onComplete stuff } </...
2
votes
1answer
333 views

Visualforce Page Redirect from Cancel

I have a simple VF page embedded in the detail page of the Contract object. The VF page is designed to replace the standard buttons on the detail page since one of the buttons needs to only appear if ...
1
vote
2answers
249 views

Visualforce CommandButton Open in Existing Window

I am trying to overwrite the standard buttons on a standard object with an embedded VF page. The reason for this is that I want a custom button to be conditionally rendered based upon a field in the ...
1
vote
2answers
40 views

How Do You Prevent Action Repeat (i.e. Send Email Again) When VF Page is Refreshed?

If I send an email from my VF page - via inputTextArea, commandButton and MassEmailMessage - and then refresh the page, the email gets sent again. How do I prevent this? Please review my code below. ...
0
votes
1answer
139 views

How to call a javascript method from an apex method to display a button

I have a use case where I have a button "Add another". I want this button to be hidden until an apex method "Save" is called. The save method calls a javascript method which in turn displays the ...
0
votes
2answers
104 views

How to detect which command button is clicked?

I have 2 command buttons on my vf page: <apex:commandButton onclick="saveAndnewmethod()" value="Save and New"/> <apex:commandButton onclick="savemethod()" value="Save"/> and they call ...
0
votes
1answer
217 views

apex:commandButton align center

How to move Button 'Create Referral' to center. I don't want that button on new Line. I want to show both Ok and Create Referral on same line, Ok on left side and 'Create Referral' to center <...
0
votes
1answer
265 views

Attach More Files: Rerender Clears Selection

When am trying to click on Attach Another file button ,selected file on first input file is getting null. Here is the code. public class SamplePageController{ public List<Attachment> ...
1
vote
1answer
1k views

Change commandButton image on hover

I am trying to build a simple VF page that has 2 buttons on it. One button creates a new record; the other links to the Reports tab. I have been able to get all the functionality working except that ...
0
votes
1answer
69 views

How to align an image-button with another button?

I am able to create a commandbutton with image in visualforce page. But how to align it with another button? This is the current result: Here is the code <apex:outputPanel id="top" layout="block"...
2
votes
1answer
682 views

Embedded VF page's refresh issue

This is an Embedded VF page on the standard Contact detail page. I am having a Command button on my VF page with following JS function: <apex:commandButton value="Click ME" onclick="jsFunction(); ...