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-controller]

A controller is a JavaScript Object, created by a standard JavaScript object constructor. In the Aura Framework, the JavaScript controller is client-side.

0
votes
0answers
16 views

Does response.getReturnValue(); terminates the execution of controller function?

I am trying to get an attribute set to the value returned on using response.getReturnValue(); and a thereafter a Boolean checked to true in a controller function. This save function saves the record ...
5
votes
0answers
60 views

Get records in Lightning web components without APEX

import { LightningElement, track, api, wire } from 'lwc'; import { getRecord } from 'lightning/uiRecordApi'; const FIELDS_SOLICITUD = [ 'DCABM_obj_solicitudABM__c.DCABM_fld_aplicacionSolicitud__c'...
1
vote
1answer
32 views

Aura Component Field Validation Error

I am tryin to handle field validation for a lightning:input field in a custom aura component. I've referenced the validating fields documentation with no success. I find my lightning:input component ...
6
votes
1answer
85 views

eval() in Lightning Web Components

This code works in JS <script> let object_1 = "value"; window.console.log(eval("object_" + 1)); </script> But I try to do it in LWC and I get the error that the variable is "...
3
votes
1answer
53 views

Simple Apex controller function never executing

I have a standard Aura Lightning Component with onChange handler, Javascript controller and Apex controller but even though everything seems to be fine, the server controller method is never called. ...
0
votes
0answers
19 views

How to set custom error messages in lightning:recordEditForm [duplicate]

I am using lightning:recordEditForm to populate specific fields in lightning component. I am also able to validate user entries by fetching field values using aura id. Is it possible to set custom ...
3
votes
1answer
201 views

The first parameter of loadScript() and loadStyle() must be an LWC component

I have a strange problem with the component and I don't know what more can i do, I'm having this problem whenever I put the lwc inside the recordPage of a custom object but in a standard recordPage ...
2
votes
2answers
133 views

How to load and use external library?

I don't know how to use the library of Pagination in a lightning web component but I can't use the example method: $('#demo').pagination({ dataSource: [1, 2, 3, 4, 5, 6, 7, ... , 195], ...
1
vote
1answer
34 views

Pagination error

I want to do a paging, but I'm having some problems. When I select the page number in pagination, the "selected" class is applied to the position and not to the number itself. My HTML: <template&...
4
votes
1answer
170 views

How to access child Web Component property from parent Aura Component controller?

I have an issue working on integration between Aura Component and Lightning Web Component. I have one nested Lightning Web Component in an Lightning Component. When I try to access the child I get ...
0
votes
2answers
36 views

Lightning Controller window.open();

When I use window.open(); in my lightning controller, it opens the URL but at the end of the salesforce's url. It does open in a new tab which is what I want but the url is confusing me. For example, ...
0
votes
1answer
39 views

How to use Array.map() in Lightning Component JS File

I was going through this blog to understand foreach loop, but the blog says that use of Array.map() is more efficient than for foreach. So, I tried implementing that in my Lightning Component, but it ...
0
votes
0answers
24 views

Copying fields data when checkbox is checked in multiple rows(Visualforce Page) [duplicate]

I have challenge I'm working on a visualforce page I want whenever the checkbox is checked I want to copy the values into input text fields in visualforce page. So here I have multiple rows and ...
1
vote
1answer
294 views

Unable to get values of selected elements in lwc js controller [closed]

I'm developing a Lightning Web Component, which has the add & delete row functionality. Each row contains 1 input text & 2 picklists. I want to capture the value of all the rows i.e input ...
0
votes
2answers
31 views

Need to get the key of an Object Array given a Value

I have a registration process that differs from each record type, I need to get the recordType Name (or label in this case) so I can give proper flow to each user. The record type selection is made ...
0
votes
1answer
150 views

Use force:navigateToURL to open new window instead of new tab

When I use force:navigateToURL, it opens the URL in a new tab. Is there anyway to force this to open in a new browser window instead? Thanks in advance, code pictured below var urlEvent = $A.get("e....
0
votes
1answer
19 views

Is there any way of hide Navigational items in community upon User Profile?

I have been asked to hide tome tabs from navigation bar on Partner Community when the logged user is Community User. What have investigated so far: Create a custom theme and replace the the layout ...
3
votes
2answers
211 views

Multiple lightning:recordEditForm

I have a quick way of entering multiple records where user can add rows(record) to add. I am using lightning:recordEditForm component in aura:iteration. When i add multiple rows everything is working ...
2
votes
2answers
220 views

jsPDF in Lightning component: get blob in Apex controller

I'm trying to use the library jsPDF on a lightning component. The lighting component handles the creation, and needs to pass it to my apex controller (in order to save the file in Salesforce). ...
1
vote
1answer
85 views

How do I populate a Lightning:combobox with content from a map?

I've generated a map in my apex controller which I would like to use to populate a combobox. Simplified code below: Component: <aura:component controller="myController" implements="force:...
1
vote
1answer
59 views

Can't handle an Application event in Lightning

I am trying to handle Application event in a listening component but it doesn't work for some reason. Please, help. I can't write in console log "here" in the end Application <aura:application ...
0
votes
1answer
54 views

Change field value in lightning component

I'm trying to change the value of the field Instagram_followers__c of my Influencer__c object in my lighthning component. It's a really simple component: a refresh button wich check the number of ...
0
votes
0answers
53 views

Issue with Save function on tabChange and textchange

I’m facing an issue registering tabset’s ‘onselect’ and textArea’s ‘onblur’ event when doing a ‘save’ on them. Below is my situation I created a form using lightning component which consists of a ...
0
votes
1answer
155 views

Saving Lightning Select Value

I'm trying to display a drop down on a custom component and once a value is selected I would like to update the value in the database. I'm finally able to load the values from the database, set the ...
0
votes
2answers
282 views

Making inputField required

How do I make the following drop down required? <lightning:inputField aura:id="esctype" fieldName="Escalation_Type__c" /> Full Code <aura:component implements="flexipage:...
0
votes
2answers
67 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 ...
1
vote
1answer
34 views

Search not refreshing when input SearchText changes

I have a lightning component which lists a list of reports. Also a search Bar so users can search from the list. I am not using Apex to perform the Search using .filter within the js controller. But ...
1
vote
0answers
176 views

Add addEventListener for blur to lightning:inputField

I want to invoke a method when inputfield is off from focus state(blur). I am trying as below but i am not able to get the alert statement when the cursor is out of focus from field . Can some one ...
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 ...
0
votes
2answers
40 views

Trying to execute 2 nested SOQLs, not getting the expected result

Here I am trying to filter the the records based on the output provided by the first soql, not getting the result I am looking for. public class DMLTest { public void DMLtesting() { List&...
-1
votes
1answer
62 views

toLowerCase method not working inside a filter method [closed]

I am trying to use toLowerCase method inside a filter method. For some reason it doesn't seem to work. Not sure what I am doing wrong here. PLz advise! mdu["aaUnits"] = allUnits.filter(x => { ...
0
votes
1answer
35 views

How to add items to lightning tree component through controller?

I am trying to add items to the lightning tree component through the controller js file on the click of a button. I already have all the data pulled in on the load event. What happens now is it just ...
0
votes
1answer
93 views

Compare fields in lightning component

I have a lightning component which the goal of it is to open a page if some fields on the record are not null, how to compare those fields to null? Here the component: <aura:component controller="...
0
votes
1answer
250 views

Extract values of the object received in the apex method!

I am passing in an object with mutiple rows of data, which eventually will be saved to the custom object. How do I extract the values of the object that I received in Aura enabled apex method. ...
0
votes
2answers
43 views

Set 'option' attribute of CheckboxGroup via Apex

So this is an example of what i need to know. Basically i want to set the option attribute of my lightning:checkboxGroup via apex I even tried with a Map instead of an Object in apex controller. ...
0
votes
1answer
89 views

Salesforce Lightning: ondblclick event not working on Select List box

ListBox.cmp <div id="div1" > <label for="picklist">Available Labels</label> <br/> <select style="width:100%" id="picklist" multiple="multiple" ondblclick="myFunction()"&...
5
votes
0answers
138 views

Passing a variable to lightning component through snapin chat

I have a snapin chat component embedded on our custom application (not salesforce or a community). I'm trying to allow a parameter to pass through to my lightning component for use in the prechat ...
0
votes
1answer
187 views

calling apex method without a return value from controller

I am trying to call an apex method through a controller. I have read somewhere the apex methods without any return should be prefixed with get. I am not sure what I am doing wrong here. It says cant ...
0
votes
1answer
17 views

Variable add on a Javascript controller inside -> component.find(' variable ') markup

I want to add a variable like this. Day value is an Integer var day = component.find('days').get('v.value'); var date1 = component.find('HDate'+day+'__c').get('v.value'); But it returns an error at ...
0
votes
1answer
64 views

Not able to push records to javascript array to use it in the component!

I am trying to push data in the controller variable to eventually push it onto the component attribute variable. As of the now the record gets pushed but it clears the previous record that was in ...
0
votes
0answers
34 views

Is it possible to set a value (in table) dynamically through lightning javascript event?

I have list of object records displayed in a table on lightning component. I would like to dynamically set a field value when another field value is changed. I should be showing the set value to the ...
1
vote
1answer
366 views

Simple Popover Example Causing: “Cannot read property 'na' of undefined”

I'm trying to get the popover example from the Salesforce documentation working and it's giving me an interupt error with "Cannot read property 'na' of undefined" message. All I have done is copy ...
0
votes
2answers
133 views

Parsing error: Unexpected token in below code of in Lightining controller

({ doInit : function(component, event, helper) { component.set(v.columns[ {label: 'Department ID', fieldName: 'DepartmentID', type: 'Auto Number'}, {label: '...
0
votes
1answer
47 views

How to send an arrayList from Apex to Javascript and then to HTML?

I'm new in JS and can't understand, what is wrong here (this is my test value, but then I want to send an arraylist's elements): Apex: public String test{get;set;} public String myApexMethod(){ ...
0
votes
2answers
188 views

How to retrieve the checkbox which were selected and deselected now -Lightning component?

I have a table where object records are displayed along with a checkbox. All the existing records are displayed with checkbox ticked. If the User deselects the checkbox on any of the rows I should be ...
1
vote
2answers
222 views

Does more logic on Client side reduces the lightning performance?

I am just struggling to understand on this as I develop a lightning component. I have object rows from apex controller which gets displayed on the component using <table>, <tr> and <td&...
1
vote
1answer
93 views

Unable to Call Apex-Controller Method in Modal-Footer Component

I have a modal with a footer. The footer is just for Cancel and Save buttons, and their respective JS functions. Modal Markup <lightning:overlayLibrary aura:id="overlayLib"/> <lightning:...
3
votes
1answer
463 views

Dynamic Button Icons in a Data Table Similar to Dynamic Actions in a Data Table

It's possible to have actions for each row in a data table that change depending on the contents of the rows (that are changed by those very actions). For example: The component reference provides ...
0
votes
1answer
21 views

Child component not displaying records from Parent record

I am passing the results from Parent component to Child component but the results are not displayed for some reason. I have gone through many example codes and it seems I have done everything ...
1
vote
1answer
224 views

Multiple calls to lightning:quickActionAPI getAvailableActionFields() fails

I get an error when doing multiple calls to getAvailableActionFields in a Promise.all(). The markup: <aura:component implements="force:hasRecordId"> <lightning:quickActionAPI aura:id="...