The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [javascript]

Javascript is a weakly typed interpreted programming language primarily implemented by web browsers to allow for client-side scripting. It can be used in Visualforce pages to give a more dynamic experience to end users. Additionally, the Visualforce engine generates and uses JavaScript to support the functionality of some of its components.

Filter by
Sorted by
Tagged with
1
vote
1answer
12 views

Referencing a static resource from within a static resource

I've got a static resource with some javascript I've written which requires another static resource to work. I would like to include the reference to the required static resource within my static ...
0
votes
1answer
17 views

Id attribute of an element gets changed in LWC

I have defined an element in LWC as <div class="popup" id="contactpopup"></div> but it renders as: <div class="popup" id="contactpopup-10"></div> any random number is ...
0
votes
0answers
10 views

Invalid or unexpected token on JS button

I have ran the below code through a couple of JS validators and everything seems to be ok. Not sure where I am going wrong with this one. I get an unexpected or invalid token error. It is script for a ...
1
vote
0answers
23 views

How to pass dynamic values to Chart.js Donut/Pie Chart in LWC?

I am using Chart.js to add Donut/Pie chart in LWC. Currently it is only getting rendered when I pass hard-coded values. What I am trying to do is, fetch values through Query and pass those values to ...
0
votes
0answers
12 views

How to use a Button to download a file in lightning?

I have an Excel/pdf file stored in the files section of Lightning. I would like to create a Button on a Custom object so that when any user clicks the button it downloads that file. How do I do this?...
0
votes
1answer
17 views

Create an LWC from a LC - JavaScript Translation

Im new to developing Lightning Web Components (LWCs) but have created some Lightning Components (LCs). Im trying to reuse some of the javascript code I wrote in one of my LCs, but am having trouble ...
0
votes
1answer
15 views

Add event listener for window resize in lightning web component

I want to ad an eventListener for window resize inside my custom lightning web component but I don't know how to do it Maybe something like this? constructor(){ window.addEventListener('resize', ...
-2
votes
0answers
17 views

How add sum in foter table? [on hold]

I have a accordion component with with a table. html code <lightning-accordion class="example-accordion" active-section-name="B"> <!-- onsectiontoggle=...
0
votes
1answer
32 views

How to calculate the average value of non-zero elements

We have an array of 12 elements, there are elements with numerical values and there are elements with zeros. How to calculate the average value of non-zero elements. Is the element from which you ...
0
votes
0answers
16 views

VF Page window.open in LEX bypass popup prompt?

I have a button in Lightning that opens a visualforce page that immediately opens a third party url link. So I want to avoid using the js command of window.open on my visualforce markup on page load ...
0
votes
0answers
13 views

HELP to convert onclick javascript to visualforce page in lightning [on hold]

{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")} var win = window.open('/apex/xxxx?id={!Bb__c.Id}&retURL=/apex/ForceWindowClose', 'Popup Name' ,"...
0
votes
1answer
22 views

I want to display two different sucess message for two button in single lightning component

I have two button in same class one is Clone button,another is Renew button,now it is displaying only one sucess message for both button,but i want to display two different success message for two ...
2
votes
1answer
34 views

Display row selection per LWC datatable

I'm creating LWC datatables on the fly, dynamically through a REST API. If I have one table, everything I'm trying to do makes perfect sense. However, since I'm creating everything dynamically, the ...
0
votes
1answer
21 views

Convert Javascript button to Lightning Action

I have to convert many javascript buttons into Lightning Action to open VF Page. Below is an example of a button on the Account record page. if( (accStatus != "Active" && accStatus != "...
0
votes
3answers
52 views

Populate radio button options dynamically

I am trying to set a radio button's options dynamically. I'm first constructing a wrapper list in my first component and passing the list to another component where I'm displaying the values. Apex ...
1
vote
1answer
18 views

How to assign aura:attribute for objects with default value null?

This must be a a very simple question, but may be I'm doing it wrong. I wanted to set default aura:attribute value to null on lightning component as below. e.g. <aura:attribute name="selectedObj"...
1
vote
1answer
24 views

Can I call a System namespace method from LWC?

I want to be able to call the System.Site.getType() method from an LWC JavaScript file. I thought this would work: import sitegettype from '@salesforce/apex/System.Site.getType'; But it gets error, ...
0
votes
0answers
26 views

Creating a hidden attribute for a web compnent that hides from DOM as well

I have created a component named <my-customobject>. Inside the component there is <my-customfield> component. <template if:true={showCustomObject}> <my-customobject> ...
0
votes
1answer
26 views

Update SQL Query Text via SSJS

I have written some simple code which i will try to loop later but I am getting no success in trying to use SSJS to update SQL queries. I don't need to perform the actual query i just need to update ...
0
votes
1answer
13 views

Connected app components randomly not loading

Connected app components are not displaying in our customers' orgs. Randomly the components are not loaded into their respective divs. Roughly 95% of the time they AREN'T loaded. If we disable cache ...
0
votes
0answers
26 views

Disable/Enable a commandbutton in VF using a function

I know that are a lot of messages regarding this issue, but cannot find the similarity into the problem I am facing. I have created a VF page - and into that VF page I have got a command button with ...
0
votes
0answers
12 views

Apex:commandButton onclick funtion not getting called after window.onload

I am facing issue with the apex:commandButton in my visualforce page. The requirement is simple : I need to check a condition and based on that I will open/close a div. That div contains a message and ...
0
votes
0answers
18 views

Upgraded visualforce page api version and breaks page functionality

I raised the api version of a visualforce page from 24 to 47. Now previously functionality is no longer working as expected. When I click the openLookUp() button the new window no longer opens up I ...
0
votes
1answer
35 views

Parsing data JS or Apex Controller [closed]

Is there a performance cost if we do business logic on the client JS side vs Apex server side ? Let's say i have an Apex controller and a lightning component. on Page load, the JS controller is ...
0
votes
0answers
11 views

On button click open the chat window for Salesforce customer chat support

My question is similar to the question asked here The answer is given there kind of resolve the issue, but that answer is in jQuery and I converted it to javascript but it's not working JQUERY: $("...
0
votes
1answer
24 views

Creating a count up timer using Javascript in VisualForce page that doesn't reset when it refreshes?

I am trying to create a timer that counts up whenever a record populates the VisualForce page using Javascript, however, whenever the page refreshes the timer resets as well. This is a problem because ...
2
votes
1answer
46 views

LWC Datatable any possible way to remove 'select all' checkbox?

So the datatable does ALMOST everything I need for my component, very handy. But I only want one selection of a row at a time. I want users to have to actually click each row if they want to select a ...
2
votes
1answer
120 views

div innerHTML with standard lightning web components

I'm trying to display a custom format for my lightning web component via rendered and innerHTML of a div. <template> <div class="container" lwc:dom="manual"></div> </template&...
1
vote
1answer
60 views

Best way to use Jquery on Lighting Web components

I want to build a lightning web component which involves the use of jquery and bootstrap. The Lighting Web Component involves multiple child components. I was going through the salesforce document on ...
0
votes
0answers
38 views

how can i assign date from html input tag to <apex:inputhidden>?

How can I store date from HTML input tag to salesforce ???? Please help me I am struggling form 3 days... this is Html input field: <b> <tr class="date-picker--wrapper"> ...
0
votes
0answers
14 views

Fullpage snap-in scroll in lightning component using fullpage.js

Would like to ask if anyone of you had implemented this full page scroll external library in lightning components? Here's the link that I want to mimic. https://alvarotrigo.com/fullPage/examples/...
0
votes
0answers
52 views

Using RxJs with LWC in Salesforce

I want to use RxJs in my LWC. I was successfully able to import RxJs version 5. However, how can I use it with LoadScript. This is my code, it is giving me the following error "of is not a function at ...
0
votes
1answer
43 views

How to access the contents of a SecureNodeList in Lightning Components

I am currently trying to access a SecureNodeList, but I keep running into errors. Before I go into depth more, I will explain what I am trying to do first, before I end up with an X-Y Problem. My aim ...
4
votes
2answers
121 views

Accessing JSON fields in html of LWC

I am calling an external system from an @wire method and it returns a json string. When I parse the json into an object I am able to use dot notation to access fields from the json object in JS but ...
0
votes
0answers
19 views

How to break an iFrame in SFDC

So i'll give you an outline of what i'm dealing with. we have a VisualForce Page displayed on a standard page layout, and then we view it in lightning UI. Now all this VF page does is passed an Id ...
0
votes
1answer
28 views

Lightning Event not firing in Component

I am working through the Aura components trailhead but am running into an issue where the component event is not firing. Here is my code: CampingList cmp <aura:component controller = '...
0
votes
0answers
28 views

LWC @track variable not causing rerender when it is reassigned from a refreshApex

My LWC code looks like: @api recordId; labels = { title, refresh }; @track showSpinner = true; @track checklists = []; dataForRefresh; @wire(getChecklists, {objectId: '$recordId'}) ...
0
votes
1answer
28 views

Javascript: Validating fields in a field set

I am working with a Javascript button to validate fields before the button can update fields. Since there are over 20 fields to validate, (With the possibility of adding more) listing out each field ...
0
votes
0answers
29 views

Lightning Web Component Scope

I have a event listener that is firing to handle the creation for new leads. Within the handler, I am calling a method to determine the source of the lead and identify the record type. However, one ...
0
votes
1answer
23 views

change the “end” attribute on an Aura:iteration using a button/javascript

I am trying to create a load more button that when clicked changes how many iterations are in an Aura:iteration. Right now the End attribute on that iteration is 10, and we would like it to change by ...
0
votes
0answers
24 views

Event e.force:createRecord Auto-fill Attendees

I'm trying to auto-fill a new Event (standard Salesforce Event object) modal with Attendees for a component I'm making. I can't wrap my head around what I fill in to make this work. I was looking at ...
1
vote
1answer
19 views

Javascript button to update record and load webpage

I can't understand why this Javascript button doesn't work. I keep getting an error: "Invalid or unexpected token" Can anyone see why this is? {!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")} var ...
4
votes
1answer
241 views

async/await functions in LWC

Assume I have an LWC component and Apex Aura controller: /* AccountController.cls */ public with sharing class AccountController { @AuraEnabled public static List<Account> getAll() { ...
1
vote
0answers
19 views

Google Map full-screen control is not visible on chrome [closed]

I have implement a web page that include a google map component. In the map all other map controls(zoom, satellite, and etc.) are properly visible except the full screen control. The issue recreates ...
0
votes
0answers
32 views

Creating of Maps and Setting the value based on key in lightning component

in JS, I need to create a map, like if my key=ABC,and 2 checkboxes were selected,map shoud contain,map="{key='ABC',value='2'}" and after if another key='xyz' and 4 chekboxes were selected,the map ...
0
votes
0answers
11 views

Trying to use validation rule on managed button

I am in the process of creating a validation rule in a managed button. I noticed that the button is managed and from searching within the trailblazer community I've learned that I need to remove the ...
0
votes
1answer
24 views

unrecognized base64 character apex

I converted a pdf file in base64 with javascript. function convertToBase64() { //Read File var selectedFile = document.getElementById("inputFile").files; var cvfiles = document....
1
vote
1answer
95 views

How to use AWS S3 JavaScript SDK with Lightning Web Components as 3rd party library

I am trying to initialize the AWS constant in my LWC component but always it is undefined. import { LightningElement, track } from 'lwc'; import { loadScript } from 'lightning/platformResourceLoader';...
0
votes
1answer
37 views

Prevent user clicking outside Custom lightning component

I have a parent custom Lightning Component which includes a custom lookup component inside, for Account Edit/Create. I want when the user starts typing (and results start to appear in a drop-down list)...
0
votes
1answer
35 views

How to access custom object fields on function in Visualforce

Very new VisualForce and Apex user here. Currently working on a Visualforce page javascript function in which I'd like to update fields on a custom object based on certain conditions. Each custom ...