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 [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.

0
votes
2answers
80 views

JSON call using SSJS to populate a dropdown list in HTML and pass it through using AMP

I have a JSON object full of County names and I want to call it using SSJS then populate a dropdown list in HTML using the Data from the JSON. JSON looks like this [ "AZ - Maricopa", "AZ - ...
1
vote
1answer
30 views

Add map values in lightning component

I want to add javascript map values to existing lightning map type variable Map type in Component <aura:attribute name="CheckedRecsMap" type="Map" default="{}"/> In js declaring a new map ...
1
vote
1answer
43 views

Promise function in WireMethod not working properly

I am writing this wire method that when the data is loaded, it will trigger off a refresh of some other wire methods dependent on the results of this wire method. I do this by using a Promise and ...
0
votes
0answers
29 views

Construct a JSON Object from many queries in Javascript Web Component

I am building a web component and would like to build a nested JSON structure in JS through multiple queries to use in my html. How would I go about this? My schema includes an object called ...
0
votes
1answer
37 views

Custom Button to create a task and send email on first click and no action till 180 days. Error when applying If condition

I am completely new to Salesforce development. Custom button on Contact object needs to create a task and send email( email template) to the contact email when Language field is English or blank, when ...
0
votes
0answers
8 views

Add custom close event to recordData

Is there any way to detect close (X) button is clicked on the dom modal box when i use force:recorddata? I am trying to addEventListener to X button in afterRender event as below afterRender: ...
0
votes
0answers
28 views

Jquery UI draggable

I am trying to implement Full Calendar external events drop in my LWC. There is an amazing example adding FC to SF LWC here: https://github.com/Gurenax/sfdx-lwc-fullcalendarjs What i am trying to do ...
0
votes
2answers
53 views

Is there a way to nest options in a lightning-combobox?

I want to use the lightning-combobox to create a nested select list. Like this. I can build it using Lightning Design System. But hoping there is an easier way to pass the options into the combobox. ...
2
votes
3answers
172 views

Iterate over Object in Lightning Web Component template

I'm struggling trying to figure out how to iterate over an array of objects returned by an Apex method to print object name + label as key. The structure of the object is the following: public class ...
0
votes
0answers
18 views

No functions defined in JS files in a zip file uploaded as a Static Resource

I am attempting to use the D3 JavaScript library in a Web Component, but am having issues getting any method to work. I have downloaded the d3.zip file from the link above, and have attempted to ...
1
vote
1answer
54 views

D3 JS Library not working with Web Components

I am attempting to follow this documentation to create a very simple bar graph, however, it seems as though Salesforce has no idea what is in my D3 static resource as it says ____ is not a function ...
1
vote
1answer
34 views

loadScript unexpected token error

I am trying to follow this documentation to create a D3 Simple Bar graph in my web component. At the very bottom you will see the section Other Useful Patterns followed by a piece on how to load a ...
0
votes
0answers
6 views

How to reload opened console tabs

I am using custom button on custom object. When i click on the button, i use onClick javascript function window.location.reload(); problem is, it only reloads active tab, where i clicked on the button....
0
votes
0answers
56 views

Error: Incorrect parameter type for subscript. Expected Text, received SetValue

I get following error in my vf page: Error: Incorrect parameter type for subscript. Expected Text, received SetValue Please share some thoughts, below is snippet from my page. <apex:repeat ...
0
votes
0answers
14 views

How to send events from subtab1 to subtab2, after the subtab2 is opened?

I want to send some parameters from one subtab to another subtab. For example, subtab1 has a link which opens subtab2. The parameters cannot be sent in url as the parameters are too long to be sent. ...
0
votes
0answers
19 views

Dynamic client side Search for Accounts in VF page

I need to make a search input - which every character that printed on the keyboard will show the closest result. for example : If I printed "uni" all accounts that they names starting with "uni" ...
0
votes
0answers
17 views

Can I call a javascript function that is defined in a vf page in a vf component?

I have javscript functions in my vf page. I am using a vf component on that page. Is there a way to use those functions in my vf component? If not, then alternatively, can I change style properties of ...
0
votes
0answers
13 views

How to rerender apex repeat in jquery

How to update apex:repeat tag in jquery. Here are sample code: $ = jQuery.noConflict(); $(document).ready(function() { $('#calendar').fullCalendar({ resources:[ ...
0
votes
1answer
18 views

Redirect without needing to disable popups

I am looking for direction on how to redirect users to an external URL without them having to have their popups disabled. Below is my current code: if (feeDue == '50.00') { ...
0
votes
0answers
21 views

Fullcalendar refetch sources

I'm using fullcalendar with salesforce, and try to refetch sources in calendar that comes from controller. Form contains select option, so on change it must refresh calendar with values (recources ...
0
votes
1answer
51 views

setCallback in contoroller does NOT work

There are two main functions of the component I want to make, 1.Display the component if there is a target record, 2.Display the items of the target record on the component. However, it will not work ...
0
votes
2answers
36 views

Add Class To Aura Component Based On Value From Apex

I would like the <div aura:id="main" style="padding:15px;" class="slds-grid"> to turn red if the escalation level is M2 or orange if the escalation level is M1. My Javascript is as ...
0
votes
1answer
41 views

Clearing data out of a list

We have an email validation process that checks a list ID for an email in order to validate if that person has already signed up. Currently the only way I know to automatically populate that list is: ...
0
votes
0answers
18 views

unable to fetch value row wise in page block table using javascript?

<apex:pageBlockTable value="{!WrapperOrder}" onclick="insert_numbers()" var="or" id="pbtable"> <apex:column headerValue="No." > <apex:...
1
vote
1answer
33 views

How to set Date field to not exceed today's date in lightning component

I have a requirement where I need Birthdate field on contact to validate so that it does not exceeds today's date. Below is the code: <lightning:input value="{!v.objContact.Birthdate}" label="...
5
votes
2answers
99 views

Syntax guide for working with Salesforce Web Components

I am struggling to find any syntax documentation related to building a Web Component, and could really use some help. For example, in my JS file I make a call to a custom APEX api that returns a ...
1
vote
0answers
29 views

Visualforce Page Force.com Site - Language Translation By Clicking on a “Change lang Button”

I have a force.com site which I would like to translate the fields name of a form when a button was clicked. What I did so far: I created a basic form I activated the Spanish translation and ...
0
votes
1answer
46 views

Struggling with basic Javascript in lwc: indexOf evaluation [closed]

I'm passing a List called weekData from parent to child lwc that looks something like this: ['29','30','31','1','2','3,'4']. It's a group of 7 dates, and I need to detect if this is first or last week ...
0
votes
2answers
24 views

To show different color on every row in a table based on condition in vf page

I need to show different color on every row based on condition in VF Page. How I will acheive this: Below is the code: Based on key value I need to show different color to every row. <table> &...
1
vote
1answer
31 views

Validation Message in JavaScript not displaying properly

I am trying to show basic validation error on each row of input text oncheck of checkbox.Initially it is displaying error correctly below the 1st field but if i check 2nd checkbox in table its ...
-1
votes
1answer
38 views

How to make a date field null on the input form of VF page?

I have a custom VF page and apex controller that mimics the standard Clone for Contracts. Currently, it is copying the date fields as they're from the previous record. However, I want to make the date ...
0
votes
2answers
37 views

Adding an element in object JavaScript

My Question is am displaying the records in Table format and there is a NEW button when it's pressed want to create a new row at the top. With all the fields empty. Here doc contains the record ...
1
vote
2answers
113 views

Where and when can we skip “this” keyword in Lightning Web Components?

Putting this everywhere in Java code is a bad practice which reduces readability of code. The same is true with Javascript in Lightning Web Components. But can we skip it like in Java or is there a ...
0
votes
1answer
133 views

lightning-datatable - remove header actions

Is it possible to remove the header (column) actions completely from lightning-datatable? It seems that no matter what I do I'm still stuck with Wrap Text and Clip Text actions. UPDATE Adding more ...
0
votes
1answer
33 views

Is there a way to change the value of a picklist on a vf page when it is copied from another picklist?

So I have a form that has 2 Address divisions. When the checkbox is checked the field values from one div copy to the other div. There is a country picklist in both the divs. But the value of that ...
2
votes
1answer
22 views

Jasmine or Mocha wrapper in Lightning Testing Service does not provide actual code coverage. How to measure JavaScript code coverage?

I have to test JavaScript code in lightning components with % code coverage. Lightning testing service report does not include code coverage information. Is there any way to measure JavaScript code ...
0
votes
1answer
20 views

Uncaught SecureElement.innerHTML cannot be used with BODY elements! when using dhtmlxGantt in Lightning Component

I am trying to use dhtmlxGantt inside a Lightning Component. CMP <aura:component implements="flexipage:availableForAllPageTypes"> <ltng:require styles="{!$Resource.dhtmlxgantt_css }" /&...
0
votes
1answer
30 views

How to access a dynamically generated html class name from a JS controller?

I was trying to concat a class name with index from the iteration component. If it's correct, how can I access this value from the JS controller? Component: <lightning:overlayLibrary aura:id="...
0
votes
1answer
26 views

How to reload a custom lightning component within a lightning page?

I have created a lightning component for a lightning page. After the final save method, I am able to refresh another related list in the lightning page using 'e.force:refreshView' but I am not able to ...
0
votes
2answers
36 views

Salesforce Apex-controller server side won't run - Lightning Component

I'm having an issue where .setCallback is not functioning . Everytime I delete an account it doesn't work. Here is my attribute <aura:attribute name="deleteholder" type="String" /> and here ...
0
votes
0answers
67 views

lightning-tree-grid link to js function?

I'm working on an lwc that has a lightning-tree-grid (nested datatable). I've made it so the name column is type:url with a link to the record. That works, but it's not really what I want to happen. I'...
0
votes
1answer
29 views

Lightning Component Helper - Passing Data

I have been reading and I can't seem to understand one part of the component - controller - helper - apex combo. If I have a lightning component that is connected to an apex controller...I am ...
1
vote
2answers
63 views

Undefined value from event

I am trying to get the value of (firstName, lastName, emailAddress, mobile) from the parent component and use it in my child component but when I set it into params and logged the values, I always got ...
0
votes
1answer
24 views

Adding a javascript button to a VF page

I need to add a button to a Case, its called EI_Case_View; this is the javascript that the button I need added to the Visualforce page: var splitHost = location.host.split('.'); var baseURL; if(...
0
votes
1answer
26 views

Assigning form field values to JavaScript object

I'm creating a form for a community using a lightning component. I'm trying to give the case object it's field values before I send it to the apex controller. This isn't working for me. form.cmp <...
4
votes
2answers
160 views

Can we See the lwc Module?

This page in the LWC developer guide talks about a component JS file, in particular: Every UI component must include a JavaScript file with at least this code. import { LightningElement } from '...
0
votes
0answers
8 views

How do I convert a checkbox functionality to a radiobuttons on a visualforce page?

There is a functionality I need to achieve. I have 2 checkbox fields. But on the vf page I need to show both of them as radio buttons. So if the 'Yes' radio button is selected it should work like the ...
0
votes
1answer
31 views

Toggle between 3 checkboxes in each row

I have a data in a row along with 3 checkboxes. I need to toggle between 3 checkboxes in each row. <apex:repeat value="{!ManagerNameList}" var="m" > <tr id="trRow"> <td&...
0
votes
1answer
47 views

Script Activity error in Automation Studio

I'm trying to run a Script Activity to update specific fields of a Lead in Salesforce (Marketing Cloud connector is already configured and working properly). Once I click on 'Validate Syntax' it ...
0
votes
1answer
22 views

Lightning Design System - VF Sorting Function

We're adding some additional functions to an older tool which was originally built using the Lightning Design System on Visualforce. The stakeholder is requesting a sort function on a datatable which ...