Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
66 views

Convert a string to html tags

I'm fairly new to LWC development so please let me know if I'm heading the wrong way here. I want to convert a string of html tags to html and to render it on my lightning component. I followed the ...
14
votes
1answer
661 views

Lightning Components: Why is the rendering of 3-level nested <aura:iteration>'s so slow?

I have been working with a nested iteration and it is causing a delay of >3 seconds AFTER loading things from the APEX controller. The APEX response itself is fast, so I'm not looking for any APEX ...
0
votes
1answer
14 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 ...
1
vote
1answer
18 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
34 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
13 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 ...
0
votes
1answer
33 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 ...
-1
votes
1answer
25 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 ...
-2
votes
2answers
1k views

A problem with the OnClick JavaScript for this button or link was encountered: missing ) after argument list

I'm create a custom button with the help of conga and JavaScript. It usually recreates send an email feature and some additional features. But I'm getting the below error. As far as I see, I didn't ...
0
votes
0answers
13 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
29 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', ...
1
vote
1answer
438 views

Automatically show the Choose file option/button when a checkbox is selected

Suppose I have one checkbox and one inputfile (Choose File). The idea is whenever I select/check the checkbox (checkbox value=true) then the ChooseFile (inputfile) will be automatically displayed in ...
0
votes
1answer
405 views

Remove selected values from the multiselect picklist in lightning

I have a lightning component which is basically a filter having two buttons, Apply All and Clear All. I would like to remove the selected values on a button click "Clear All" The filter looks like ...
3
votes
2answers
437 views

onUtilityClick() refresh component

I am trying to build a utility bar item that is refreshed when the user closes and reopens it. I tried implementing the onUtilityClick() function in my init method but I'm getting the error 'Error: ...
0
votes
0answers
19 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 ...
2
votes
1answer
55 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
25 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 ...
3
votes
1answer
661 views

JSForce - getting OAUTH2 refreshToken - variable app is not defined

I am clearly missing something called app here. I am following Authorization Request section from the documentation. It says your app is callbacked from Salesforce with authorization code in URL ...
0
votes
3answers
61 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 ...
0
votes
1answer
26 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
1answer
842 views

How to check live agent availability from apex?

I've been using JavaScript to check live agents availability for a while now and it was working fine until a recent change of requirements. This is what I currently do: if (!window._laq) { window....
1
vote
1answer
27 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, ...
1
vote
1answer
26 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
545 views

Add data in apex:pageBlockTable using jquery and get its data and send back to apex class

I've made an apex class which is something like this: public class formBuilderClass { public Map<String,List<String>> objectFieldMap { get { if(...
11
votes
1answer
636 views

JS Synchronous Calls - Email with Attachment

I'm trying to set up a JS button on a SFDC object record that sends an email to a recipient with a specific attachment from the Notes and Attachment related object. Would I theoretically be able to ...
0
votes
1answer
31 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 ...
5
votes
1answer
2k views

Programatically add focus on ui:inputText

I'm afraid I'm hitting a limit of Lightning here, but I'd thought I ask here as a last resort. I want to programmatically add focus on a field in a form. I now have code like this; Markup: <ui:...
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 ...
1
vote
1answer
503 views

Custom, dynamic highlight panel

I am attempting to create a custom highlight panel. What I ultimately need to do is on the focus of a subtab, I need an event to fire and send information to the highlight panel. The highlight panel ...
0
votes
2answers
597 views

Show Loading gif after onchange() in inputField

I have a very simple VF page that calls a method in my controller to populate a selectoptions. The method in my controller calls an external API so it takes a bit of time to populate selectoptions. ...
0
votes
2answers
615 views

Disabling the custom Button

I created a custom button detail page button and using that in my detail page. That button executes JavaScript code.I want to deactivate that button once it is clicked. Can we deactivate the custom ...
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
2answers
2k views

Dynamically Add Rows in Lightning

I know this question has been asked before, but I've run across different code that supposedly works, but isn't working for me. The error I keep getting is: "Uncaught Action failed: [...] [...
0
votes
1answer
585 views

Download function not working with IE but works fine with Chrome and Mozilla

In my org we have a Vf page with a download link. Onclick of this link a csv file is downloaded. This is working absolutely fine with Chrome and Firefox, but the file doesn't download with IE. Any ...
2
votes
1answer
715 views

liveagent.init callback function

I am trying to setup liveagent but am running into an issue with starting the chat. We have a form that the user enters information about themselves, and then a button to begin the chat. I use the ...
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
12 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
27 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 ...
1
vote
1answer
782 views

How to get picklist values based on record type in javascript VF page

I am using Javascript to get picklist values(dependent or normal picklist).Its working fine. But the problem is i am getting all the Picklist values for that object. I have to get picklist values ...
2
votes
1answer
143 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 ...
0
votes
0answers
39 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"> ...
1
vote
1answer
95 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 ...
2
votes
1answer
239 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
2answers
616 views

Regex on lightning:datatable

I'm using lightning:datatable to display the Account object in a table. I've also added a regex that lets users search for any field in any column. What I wish to do is, if there are no matches, ...
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/...
3
votes
1answer
595 views

URL Whitelisting in Salesforce Console

In the Salesforce console, we have an user action that will open the Email tab using the Email Url. For example: ui/core/email/author/EmailAuthor?p3_lkid=001E000000CVCF7&retURL=%...
0
votes
2answers
1k views

Action Method and JavaScript Function

Can anyone tell me how to execute the action mthod as first and javascript function as second based on the result of action method. My problem is: I have command button which has action method and js ...
0
votes
1answer
583 views

Value not fetching in javascript from apex

Page: <apex:page Standardcontroller="CF_Sections__c" extensions="CF_SectionEditController" > <apex:includeScript value="{!$Resource.KylieJS}"/> <script src="/soap/ajax/20.0/...
0
votes
1answer
1k views

splice js function is not working in lightning component

JS controller OUTPUT input of json input json getting out not expected output json var lst = JSON.parse(JSON.stringify(component.get('v.lstPetval'))); var lstInsert = []; var ...