Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [onclick]

The tag has no usage guidance.

6
votes
1answer
745 views

Possible to call a javascript and action function from click

I want to call a Javascript function as well as issue a backend call at the moment a button is clicked. This is my code right now : <apex:commandButton value="Search" action="{!objectCollection}...
5
votes
1answer
10k views

OnComplete Javascript to pop up alert and Redirect to a record page

I'm stuck with onclick and oncomplete. looking for a solution on this. I have a controller that simply saves a Case record. I want to display a Message to User that 'Your case is saved with {!caseId}...
4
votes
4answers
6k views

Preventing a reload/refresh on form submit in Lightning

i have created a form in salesforce lightning using form tag and one button there is inputtype="submit", value="submit", i dont want to reload the page when submit clicked. please help me out. <...
4
votes
1answer
745 views

Validating sObject fields in JavaScript Custom Button?

I have a button that should update a boolean field to true if certain conditions are met. I want to do my validation in the JavaScript that fires on button click instead of letting the system run ...
3
votes
2answers
2k views

Visualforce: Checkbox is not firing function onclick

I've tried everything I can think of to get this checkbox to work. This code is just supposed to trigger a function when a checkbox is checked. It currently does not trigger the alert, it only "...
3
votes
1answer
80 views

How to detect showListButton/hideListButton being clicked on collapsible PageBlockSection?

I'll go through it in text, but here is a short video detailing my problem: video Hi, in this sample code I have collapsible PageBlockSections which are collapsed by default. Currently, when a ...
3
votes
3answers
16k views

Refresh Page After OnClick

I have a custom VF page acting as a button. When the button is refreshed, a checkbox is either checked or unchecked. All that works fine, but I cannot figure out a way to reload the page after the ...
2
votes
2answers
497 views

How to get all buttons in my page from a controller javascript function(component, event, helper)?

I know how to enable the clicked button. Lets say I want to enable all buttons on the click of a button. The button is in a Lightning component as: <aura:component implements="flexipage:...
2
votes
2answers
9k views

Using action and onclick together on command button

I have to call an apex function only when javascript validation passes. Hence,initially I tried the below code: <apex:commandButton value="Submit" onclick="return addDomain();" action="{!...
2
votes
1answer
34 views

OnClick Javascript button error when merge field value is “St. John's”

I'm working with a Detail Page Button that executes OnClick Javascript. Most of the time it works just fine. However, in this particular instance, one of the merge fields in the script has a value of "...
2
votes
1answer
1k views

CommandButton oncomplete JS function not firing [duplicate]

I have run into an issue with an apex:command button, where the oncomplete part of the process is not being called, and prevents the button from completing its action. The VF page is a component on a ...
2
votes
2answers
516 views

OnClick Javascript attached to Custom button not working correctly

I have a custom button in a layout created for a custom object. Upon clicking, if some conditions are fulfilled, I would like to execute some code and otherwise I want to display a popup. I use the ...
2
votes
1answer
27 views

Getting error function not defined while it's there

I need to call the jsPdf function, however in the console I am getting genPdf is not defined. Here is my code-- <apex:page controller="GenerateQuoteController" standardStylesheets="false" ...
2
votes
2answers
1k views

Action failed: lightning:button$controller$handleClick [d.run is not a function]

I have a lightning component called modal which is used in another component called Split, the modal takes an array of buttons to render them (and does some more) I have a working version of it in ...
2
votes
1answer
955 views

OnClick JavaScript Button, Invalid or unexpected token error

Here is the field I am trying to update, the far left is the picklist I am wanting to update. the field on the left is another picklist. both lists have the same values. As you can see below I have ...
2
votes
1answer
423 views

VF Page on-click events for HTML elements

I have a checkbox on my VF page, with the label in a <TD> element of the table, and the checkbox in a <TD> element next to it like this: <tr> <td class="LeftColumnTop W50" ...
2
votes
1answer
7k views

Apex Command Button using action and onclick not working

What I'm trying to do is have an Apex command button that on the click opens a new VF page and also, have an action that does some backend query to get data ready for the popup VF page. Not sure why ...
2
votes
2answers
435 views

Custom Onclick Javascript button query

Today we got a notification from Salesforce to remove scripts from home page components and put them in Visualforce areas. Eventhough we are not impacted by this specific notification, I am just ...
2
votes
2answers
224 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: ...
2
votes
0answers
228 views

New button pop is not showing to create new record in Lightning

i am new to lightning and trying to learn lightning. i have created component in that component i am showing the contact based on the accountid using (implements="flexipage:availableForRecordHome,...
2
votes
0answers
820 views

How to display alert pop up for inserted record Id and redirect the VF page to another VF page

I have a custom VF page 'HOMEPAGECOMMUNITY'. I would like to Navigate to 'LANDINGCOMMUNITY'. I have a commandButton 'Submit' which is associated with couple of Rerender Id's for PageErrorMessages and ...
2
votes
2answers
1k views

How to Call two action from one Command Link? [duplicate]

I have to call 2 URL on click of command Link , one will Record Edit Page URl and Another is different Webserver URl I have tried two Ways Both are Not Working.....I mean both action is Not ...
1
vote
1answer
2k views

Cannot read property 'value' of null in this case

I am trying to get the value of a text field in a VF page in Java Script. Below is my VF page. <apex:page id="thepage" standardController="Opportunity" extensions="OpportunityExt"> <apex:...
1
vote
2answers
4k views

Confirm Dialog Box On Detail Page

I wanna add a custom button (Send Mail) on contact detail page, And is email field is having an email then on click he ask with a popup "Wanna send a mail ?" And wanna add 'Yes' Or 'No' instead off '...
1
vote
4answers
761 views

Custom send email button: Only send once

I've got a fantastic OnClick JavaScript button set up which will check if two fields are the same and populate the to/cc fields on an email template accordingly. Now, however, I want to somehow ...
1
vote
2answers
3k views

Adding onclick to dynamically created button

I have a component that dynamically creates buttons which, when clicked, apply filters and then re-query the back end for data. While I can assign onclick events to each button, I can't find a way to ...
1
vote
2answers
861 views

Call Public class method from onclick javascript [duplicate]

I have a public emailing apex class I need to call that from onclick javascript button of a detail page. Can someone let me know , if I can do that? Please give me an example. I am not getting it. I ...
1
vote
1answer
310 views

Query on Javascript get error Malformed_Query

I create list button OnClick Javascript Button on Lead. it will update the Is_Picked__c checkbox on selected record whenever i click the list button. but i still get MALFORMED_QUERY. Any thoughts? {!...
1
vote
1answer
490 views

Making a checkbox field value null using a JS function

I am trying to set the value of a checkbox(custom field) to null in a VF page using Javascript function.Below are bits and pieces of my code. This happens when the user clicks the tag. An Onclick JS ...
1
vote
1answer
118 views

On-Click Button: Why is Salesforce passing in 'undefined' string value?

I am trying to auto-insert an array of Tasks based on the Accounts selected in the Account 'List View' tab. The tasks are inserting as expected, but instead of writing the Account Name in the subject ...
1
vote
2answers
286 views

Insert record to a different object cloning data from detail page

I have a custom detail page button to run OnClick Javascript on custom object Form_Requests_abv__c. On this button click it should do two operations. 1. Create a new Sample_Order_Form_abv__c record ...
1
vote
2answers
223 views

Call Record's JS onclick button from a VF page

I have created a custom button on a record that calls onClick JS to update the record. I would like to call the same JS button's function, from a VisualForce page. The purpose for this is so that I ...
1
vote
2answers
994 views

How to pass map<string,string> as parameter in javascript

I have a method : webservice static String myMethod(String objectType, String recordId, Map<String,String> fieldValueMap ) I need to pass this in onclick javascript custom button. sforce.apex....
1
vote
1answer
1k views

returning Javascript onclick prevents button from using it's action

The action part of my button stops working as soon as I change my button to return my javascript confirmation. Javascript: function confirmDialog() { var confirmation = confirm('Once you submit ...
1
vote
0answers
168 views

Get event source from onclick handler in outer div

In my lightning components, I am trying to create a system that keeps track of every button that gets clicked inside my component. Having an event that fires whenever any button is clicked turns out ...
1
vote
1answer
348 views

Custom button on list view limitations

I have a custom button on my accounts list view to change the record from the current owner to my ownership using OnClick Javascript. I have admin privileges and when I use the button it succeeds in ...
1
vote
3answers
5k views

Salesforce Custom Button OnClick Javascript - Create multiple child record

I have Error for my custom button javascript for create multiple child record. my code is: {!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")} //identify ...
0
votes
2answers
542 views

Adding One Year to Date Field Value Through Custom Button

I'm going through one of the Force.com workbooks and attempting to add some functionality to a Date field using a custom button. On click, I want to button to update the appropriate field by moving ...
0
votes
1answer
128 views

commandbutton on a vf page inside a section

I put a "new " button inside a vf page and after I inserted that vf page inside a section on the Account page layout. When a user click new, has to be redirected on the custom Object Referente ...
0
votes
2answers
2k views

lightning dynamic component datatable onclick/onrowselection

I have a lightning component that dynamically creates a lightning:datatable when apex returns a list of records. For the most part its working, but im trying to add an onclick event to the row, but ...
0
votes
1answer
551 views

Onclick javascript button click show available records of custom object

I have a requirement to have a custom button on Account detail page. A click on that should show all available records for logged in User of a custom object Approved_Documents_vod__c. This object has ...
0
votes
1answer
384 views

OnClick Javascript Button causing error on field with separate lines.

In the button code, the line dog.colMrk__c = "{!Birth_Record__c.Characteristics__c}"; causes an error "Unexpected token ILLEGAL" when there are separate lines in the Characteristics field. Is ...
0
votes
3answers
218 views

Custom Button to send email no working

I did create a custom button(OnClick JavaScript) to send an email. It is working fine with system admin. But when I did deploy it in production the users with profile other than system admin ...
0
votes
1answer
1k views

Aura Iterate, get the aura:id of a span

I'm trying to get the ID of an element that is in a loop to trigger an event, but I can't get the ID nor content of the tag. I've done something similar on visual force pages, but I did it ...
0
votes
1answer
664 views

Update controller variable from visualforce button/div onclick

I am having issues with my visualforce page refreshing everytime I perform an onclick action? Any ideas public without sharing class LMS_CaseNewEditController { public Boolean recordClicked ...
0
votes
1answer
472 views

Updating a record, and related record using a custom button

I am trying to build an onClick JS button on a custom Object called Application. The button is designed to update 2 fields on the the Application, and a related record's field on the Opportunity ...
0
votes
1answer
34 views

How can I reference an installed pkg VF page in an OnClick Javascript Detail Button

I need to update this hardcoded url before an instance refresh and I am having difficulties finding a solution. The VF page is from a managed package that has the namespace of scl I have tried to ...
0
votes
1answer
616 views

If statement fails in Onclick javascript button

I have below code where if statement that needs to work based on 'check' boolean value, is not working properly. Although, 'check' value is true it navigates to the else block. Can someone please let ...
0
votes
1answer
786 views

Uncaught ReferenceError: callAF is not defined

I am trying to update the checkbox(checked or unchecked) in the database from the UI. I am calling the js function on onclick of checkbox and invoking controllers action but I am getting this error. ...
0
votes
2answers
32 views

Passing argument to onclick event

I am dynamically creating HTML <div> and I need to handle the onclick event : when the user clicks on it, I want to call a controller function and this function requires an argument. How do I ...