Questions tagged [onclick]
The onclick tag has no usage guidance.
105 questions
0
votes
1
answer
76
views
LWC - New Correspondence Modal is not working
I have following code for my LWC component. It does not open modal window when I click "New Correspondence" button. I reviewed code so many time and couldn't find what is the issue here.
Any ...
3
votes
3
answers
2k
views
Understanding different events fired by LWC Components
When to use event.target.value, event.detail.name or event.currentTarget.name and what else.
More Info
While building my LWC I ended up using all the three above event variables because in certain ...
1
vote
0
answers
116
views
Custom visual picker onclick fires two click events (LWC)
This morning I'm told a visual picker doesn't work anymore. Simplified version:
<template>
<div class="slds-visual-picker slds-visual-picker_medium" onclick={handleClick} style=&...
1
vote
1
answer
482
views
LWC Repeating Lighting Layout Items with for:each record set and on-click action not getting ID of item clicked
Primary goal:
LWC on Campaign Lightning Page (done)
Get list of Campaign Members from apex wire (done)
Generate list of Campaign Members on left half of screen using lightning layout items (completed)...
1
vote
1
answer
512
views
LWC - render component onclick event
I have a lightning button and I have an instance of js Date class.
When I click on a button I want it to to show me a date that was week before (subtract 7 days).
Here is my .html file:
<template&...
1
vote
2
answers
2k
views
Change text & prevent double click of LWC button
I need to prevent double clicking of a button. My goal is to disable it while im the DML operation is not completed. I am new with LWC so i don't exactly know how to proceed. Right now i just have the ...
1
vote
0
answers
2k
views
I have a button in LWC Datatable which will view cases, i want to switch between hide/view case using same button inside LWC datatable. How to achieve
Below is my component, when i click view case it shows all cases associated with the account, and should change the label to hide case. And when clicked on hide case it should hide the cases shown ...
0
votes
1
answer
3k
views
Get RecordID when i click on button in Lightning Data-table(Child component) and dispatch it to parent component to display related case
I'm a beginner, learning Child to Parent Component communication. Need to get the recordID of account onclick so that i can use it to display cases related to that particular record.
On the Click of ...
1
vote
1
answer
3k
views
pass Id in onclick to js controller
I'm trying to write my own version of pills in LWC without using the base component. I want to be able to pass the item.Id once a pill is clicked, but I always get undefined.
HTML:
<template ...
0
votes
1
answer
912
views
Lightning icon inside a tag not working properly
I have used html table to show list of records with custom pagination and sorting in lwc component. For sorting, I need to have up and down button along with text on headers.(Clicking on header text ...
0
votes
0
answers
5k
views
Onclick row in Datatable LWC
Hi guys :) I am new in programming and salesforce.
I want to get to the apex and take a name of click company can you tell me what schould I wite in field message = 'NAME OF CLICK COMPANY';. When i am ...
0
votes
1
answer
489
views
Button showing/hiding parametr LWC [closed]
Hi :) I am new in programming and salesforce.
and now i have a problem with buttons. I want to one click it and show a param from js (data).
(company.date schould show just when I will click button)
...
0
votes
2
answers
928
views
LWC Component failed to display
Hi I am new to both coding and LWC, just trying to create a simple component that displays a table of order items in two columns. I want to display only first three items then display a "Show ...
0
votes
0
answers
125
views
How to make a column in lighting datable call JavaScript function?
How to make a column in lighting datable call JavaScript function? This column has to be editable at the same time. Something like in the picture below - but when clicked the account name has to call ...
1
vote
1
answer
3k
views
How can I get the nearest data-id of the clicked element? [duplicate]
On an html page, I want to dynamically draw elements and I want to determine the data-id the nearest element li that contains the clicked element a, and then add a class to the element with the li ...
0
votes
1
answer
802
views
Update value in object field checkbox by clicking custom button [closed]
I want to know how to update check box object field. Currently the check box by default the value is uncheck(false). But I want when user click yes button, the check box object field(yellow ...
0
votes
1
answer
730
views
How to open a new form on top of the current one when clicking the button? [closed]
I have a "new" button in my aura component (lightning: button). When I click on this button, I want to open a new form ("New Contact") on top of the current form, in which I need ...
3
votes
0
answers
2k
views
Close Toast Message with messageData on hyperlink click - lwc
I have a toast message in lwc that uses sticky mode (does not go away until the user click on close symbol) and also messageData (to add a hyperlink in the toast for the user to click on).
The thing ...
0
votes
1
answer
2k
views
Auto focus to first cell of empty row in lightning datatable when new is clicked
I have a Add button and a lightning datatable.
When I click on add button I want to add a row to datatable.
Now, Instead of showing a popup (after clicking add btn) I want to show an empty row and ...
0
votes
1
answer
3k
views
SSJS onClick function in Marketing Cloud
I'd like to use the onClick Event on the a element in Marketing Cloud to create a new field in a data extensions when clicked and later fill out this field with a letter A.
For now I focused on ...
0
votes
1
answer
863
views
Is it possible to put a validation rule on a formula field that is a hyperlink?
I have a formula field that has a few conditionals with a hyperlink as a potential outcome.
I want to put a validation rule on the formula field that doesn't allow the user to click the hyperlink ...
0
votes
1
answer
1k
views
Button icon with possibility of passing parameters and get element
I have a IconButton , but to pass parameters to the JS, I use regular Icon with span like this :
<span onclick="{!c.copyLink}" data-theurl="{!item.path}" data-caseid="{!item.id}" >
<...
1
vote
0
answers
668
views
window onclick listener not working properly
I have created a custom lightning web component that, if an specific div is found on the template and you're clicking outside of it, it must close the current div
constructor(){
super();
...
1
vote
1
answer
3k
views
press and hold mouse event in LWC
I have a below button in LWC
HTML:
<lightning-button-icon icon-name="utility:chevronright"
onmousedown={slideRight} variant="bare">
JS:
slideRight() {
this.template....
1
vote
1
answer
632
views
Nested lightning:button onClick Not Firing
When I have a button inside a component inside a lightning:card either as a body element or an action, the onClick is never fired. If I move the lightning:button outside of the container, the event ...
0
votes
0
answers
1k
views
Why .addEventListener("click" doesnt work on mobile but works on computer?
I have an LWC that works perfect in computers but doesnt work on mobile Devices
marker.addEventListener("click", function(e){ // Centra la pantalla al marker seleccionado
...
0
votes
1
answer
2k
views
Refresh lightning:tab on change
I Built a lightning component which is used in opportunity layout. This component used some child component as lightning tab.
The problem is when I edit and change some value in first tab is not ...
2
votes
1
answer
2k
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" ...
0
votes
2
answers
929
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 ...
0
votes
1
answer
910
views
Dynamic DOM : firing event on click
I am dynamically creating some DOM elements inside my component's controller and adding them to the page. I need to set the onclick event on these elements to call another controller function that ...
1
vote
0
answers
750
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 ...
0
votes
1
answer
153
views
Reference a controller function for a dynamically created DOM element
In my helper, I have a function that is dynamically creating multiple . I want the onclick event to trigger a controller function : I tried the following code :
accordionWholeDiv.setAttribute('...
0
votes
0
answers
615
views
Lightning component navigatetoURL to open Lightning App Page
Using Aura:component with figure onclick to open URL which is another Lightning App Page. Cannot get the URL syntax correct. It's a managed package so will have different MyDomains. The Lightning App ...
2
votes
0
answers
683
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,...
0
votes
0
answers
779
views
onclick event not working on dynamically created <li>
I have a component where upon aura:iteration (data loaded from server onInit), other components are created (list items of an SLDS lookup). The issue I have is, the onclick on the LI does not fire ...
0
votes
2
answers
2k
views
Onclick javascript button - how to enable and disable based on profiles
Onclick javascript button - how to enable and disable based on profiles. For example the button should be displayed based on no of days created , if more than five weeks the button should be visible ...
1
vote
2
answers
5k
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
1
answer
4k
views
Lightning OnClick Not Working Within aura:iteration
I've been unable to get onclick actions to work in my organization when the onclick element is within an html <aura:iteration> tag. The onclick action works when I put the <a> tag or <...
0
votes
1
answer
244
views
Nested IF statements on a button's onClick
I am working on a custom Visualforce page where I have requirement for a button to function based on a criteria.
This working good:
<apex:customButton onclick="{!IF(OR(c.first, c.second), '...
2
votes
1
answer
111
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
2
answers
5k
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 ...
0
votes
0
answers
1k
views
<input type="radio" returning ON with onclick function
To my previous Question, I did some more debugging and ended up log with OnClick value: on
Good thing is, I have my LightningApp on the Internet Explorer which helped to get to the console logs(...
2
votes
1
answer
2k
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 ...
0
votes
2
answers
3k
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
1
answer
501
views
If Condition for onclick not working
I am looking for a way to insert a record and close the window with the VF-Page, when everything was entered correctly and user clicks button. The values are entered correctly, if a subject was ...
0
votes
1
answer
2k
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
2
answers
112
views
onclick Javascript failing to pass If Condition
What could be wrong with this code? I'm fairly new to javascript and I've been trying to debug on my own to no avail.
The alert('confirmed: ' + records[i].ENQ_Confirmed_with_Enbridge__c); shows ...
1
vote
1
answer
2k
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
1
answer
4k
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:...
2
votes
1
answer
4k
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 ...