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.

Filter by
Sorted by
Tagged with
1
vote
0answers
184 views

How to pas picklistvalues into label lightning component states Discription undefined

I want to pass the picklist values to a label of a checkbox but get error [Cannot read property '$getDescriptor$' of undefined] Here is my code apex controller: @AuraEnabled public List<...
1
vote
2answers
323 views

Pass a list collection from a search to new filtered list lightning controller

I have followed a tutorial to create a custom search lightning component to search a list of contacts based on an event search which works fine. What I would like to achieve is to get the result of ...
0
votes
2answers
8k views

Lightning button to redirect to record detail page

I am very new to lightning and have a basic issue with creating a button. My requirement is that when i click on 'check my budget' button it should redirect me to the corresponding budget record of ...
4
votes
2answers
26k views

Lightning response.getReturnValue() question

I did not find much info on the "response.getReturnValue" function and what it exactly returns. I understand that this is the function that must be used when a Client Side JS controller calls a Server ...
0
votes
2answers
9k views

Create New button on lightning Component

I have a lightning Component to display the Account and its Contact relationship in tree view using Accordion SLDS. On this page, I want to put "New Contact" button to create a contact record. Is it ...
2
votes
1answer
2k views

Multiple enqueueActions

Is it possible to have multiple enqueueActions? I know you can nest them as posted on this website https://developer.salesforce.com/forums/?id=906F0000000kKDRIA2. However, I would like to have ...
1
vote
2answers
7k views

Component Initilization Error: cannot read property 'g'

Everything was working fine with this component a couple days ago. Then I added an event and now I'm getting a strange error: Uncaught Component class instance initialization error [Cannot read ...
2
votes
0answers
374 views

Embed Lightning component in Leaflet map popup?

I'm using Leaflet inside a Lightning component to map locations of a number of entities. I'd like to display a Lightning component in the Leaflet popup for each entity, and I'm struggling to connect ...
1
vote
0answers
81 views

Lightning Attribute: Get JavaScriptObject

I have a lightning component with this attribute: <aura:attribute name="transportData" type="Object[]" access="global"/> I am getting the data from a http Request: $.ajax({ url: "...
2
votes
1answer
2k views

ComponentService.createComponents(): 'callback' must be a Function pointer. : false

I want to be able to call $A.createComponents(type, attribute, calllback); with values in an array. SF doc I am following: Dynamically Creating Components. But the obvious value of this would be to ...
1
vote
1answer
3k views

Understanding error: [Value number out of range for numberformat options property style]

I'm working through a Trailhead tutorial, and I am getting an error that confuses me. I've reduced it here to the minimum code I can for reproducing the error, and I'm hoping someone can explain to ...
0
votes
1answer
176 views

Error occurs as soon as I type in input

I am creating a lightning component that takes input and creates a new record with it. As soon as I type in the first input text field the following error occurs: TypeError: Error in $A.getCallback(...
0
votes
1answer
1k views

Using Callback when calling server side function

I load some values using <aura:handler name="init" value="{!this}" action="{!c.loadOptions}" /> in my component. I want these values to be populated when my component is loaded. Basically it is ...
3
votes
2answers
4k views

lightning:input help -- keyCode

I'm seeking more info on lightning:input for use in a Lightning Component. What I want to do is have the input text field submit when the user presses the Enter key. However, the Enter key seems to ...
0
votes
1answer
2k views

how to do Lightning data binding between two components [duplicate]

How to show list of contacts in a child component based on the Parent component Account Id, I have a Parent component which shows the list of Accounts and I would like to get all the related contacts ...
5
votes
1answer
1k views

Can't get object property in lightning component controller

I am trying to access JS object properties in the client controller. I get undefined if I try access it by name. But I see the properties if I log the whole object. Something I am missing? var ...
4
votes
2answers
10k views

Scroll Page to top onClick of a button in Saleforce1

I have a problem scrolling to the top of a lightning component page in Salesforce1. I have tried using window.scrollTo(0,0); Added the below attribute in the button tag oncomplete="window....
0
votes
1answer
403 views

Conditionally display html based on apex:variable

I've seen Conditionally Render HTML in Visualforce but it seems to handle the checking on the apex side then simply reference that when determining whether to display but I don't think I can do that ...
3
votes
1answer
27k views

Lightning Component: Cannot read property 'get' of undefined

I've read through the different posts regarding this error, and for the life of me I cannot figure out why it's not working right.... I would really appreciate some help. I've checked to make sure ...
0
votes
1answer
150 views

Event Conflicts with DOM Style attributes

I have a parent component and one child component. Child component is a table which does calculation and the calculated value is sent to parent component through event. On each time calculate function ...
14
votes
2answers
4k views

Is it possible to clear force:inputField?

I have a force:inputField field on my lightning component acting as a lookup. It is working fine: <force:inputField aura:id="segmentid" value="{!v.campaign.Survey__c}"/> <ui:button press="{!...
0
votes
1answer
6k views

Lightning component javascript getReturnValue of String [duplicate]

Having Issues with getting the returned string from the apex controller. If I use getState and check if success it wont run and will only run if there is an error in the state. Just from a glance ...
0
votes
0answers
95 views

facing Access Check failure issue with Dynamic Picklist lightning component

I'm trying to dynamically create a picklist in lightning component. But i am facing Access Check Failure Access Check Failed! Component.setupAttributes():'size' of component 'markup://ui:...
0
votes
1answer
1k views

aura:if inside aura:iteration

I want to conditionally render each item in an iterating list. It has to check if each contact in the iterating list is included/contains in another list of contacts. How should I approach ? ...
0
votes
1answer
287 views

Dynamically recreate a component

Hello I am having a hard time refreshing a component. I want to totally recreate a sub child component from a child component(parent of the sub child). I am trying to implement as given in Refresh ...
2
votes
3answers
21k views

aura: method to call child component controller function not working

Using <aura:method>, I am not able to call child component controller function from parent controller. Below code. Parent Component <aura:component access="global" implements="force:...
1
vote
1answer
996 views

How to handle JSON Exception in lightning component

I want to prevent the exception thrown on the lightning page as below image, and render it as a or to the user. Instead of this Exception / Callback ERROR message , i want to display on my component ...
1
vote
2answers
2k views

pass string value from apex controller to js controller in lightning

I'm new to lightning. Need your help. I have to check for a field value in Case fields and add an error Div / Message on the component. This component will be used for Lightning actions as a custom ...
2
votes
0answers
385 views

JS controller - get all aura:attribute

I've got component with some attributes. For example: <aura:attribute name="missedCalls" type="List" access="global" /> <aura:attribute name="tryingToInitiateCall" type="Boolean" access="...
2
votes
0answers
413 views

ui:inputCheckbox disabled property not working in Microsoft edge

I am dynamically rendering disabled property of checkbox to true or false from controller. This works fine for other browsers but does not for Microsoft Edge. The checkbox remains disabled, i.e it is ...
0
votes
1answer
1k views

How to get current cursor position in Lightning:inputrichtext field?

How do I get the current cursor position in a lightning:inputrichtext field? Say an event is triggered and I want to insert text at the cursor. What does the js look like?
27
votes
3answers
20k views

How do I debug my lightning component?

I have seen and read many posts in regards lightning component errors and realized there are no questions actually asking how to debug them. I recently stumbled upon: How do I start to debug my own ...
4
votes
2answers
972 views

Packaging custom labels used in lightning helpers and controllers

So in our lightning code base we usually refer to labels from js helpers and controllers as the following (it's static reference, not dynamic one): $A.get("$Label.c....
0
votes
0answers
435 views

"unable to read sobject error " on javascript controller in lightning

I have a scenario where i am displaying tasks from 2 orgs. I am able to edit and save the tasks displayed from the self org. But the tasks edited for external org throws an error that unable to read ...
0
votes
2answers
1k views

Lightning server-side method returning "undefined"

I have a very simple Lightning controller class that upserts a Contact record: @AuraEnabled public static String saveContact(Contact newContact) { Contact c = newContact; upsert c; return ...
1
vote
1answer
1k views

Vue.js in Visualforce Page [closed]

I am trying out my first development with Vue.js in Apex page. I am doing the first example of navigation Menu from here but getting error as below. Error: Attribute name "v-on:click.prevent" ...
0
votes
1answer
450 views

Vf Page Using datepicker JS calender

VF Page- <apex:page showHeader="false" controller="Test4"> <apex:stylesheet value="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <apex:includeScript ...
2
votes
2answers
9k views

Lightning addEventListener to li

I'm trying to add an event listener anytime something inside of a li is clicked, but I'm having issues with it. Component <aura:handler name="init" action="{!c.doInit}" value="{!this}" /> <...
3
votes
2answers
4k views

urlEvent is undefined

We have below code being called from Cancel button on a Lightning component. We have used this lightning component on VF page. navHome : function (component, event, helper) { var urlEvent = $A....
3
votes
2answers
503 views

How to read parent APEX page element value inside a Lightning component?

We have a VF page with Lightning components on it. we need to read a User input (i.e. Apex control value) inside my lightning component JS controller. It seems that, document.getElementById("...
2
votes
1answer
715 views

Call Js function in the right order

I'm trying to call functions in the right order in my lightning component. First, I would like to call doInit, then, I would like to trigger a function after the script is loaded. How can I achieve ...
6
votes
2answers
977 views

Locker Service and Fullcalendar.io

I have seen that there have already been some questions regarding the open source Fullcalendar.io and the various libraries associated with it, and the strict requirements of Locker Service, but I was ...
0
votes
0answers
45 views

dynamically retrieving data from ui:inputs, using component.find.get

I dynamically render ui:inputTextArea's depending on active user. Making it possible for them to update where they wish. I was hoping I could dynamically retrieve the data as well when they hit save ...
0
votes
1answer
3k views

Need to iterate multiple attribute values along with each other

I have Multiple attributes in my component and need each to iterate along with each other. I can only iterate each attribute values separately as of now. Component =========== <aura:component ...
2
votes
2answers
4k views

How to add dynamic variable to custom label in lightning javascript helper class

I am using a custom label in lightning controller/helper as: $A.get("$Label.c.MaxCountProducts"); And the label has value as: Maximum Product(s) count {0} is exceeded. I want to dynamically ...
4
votes
1answer
7k views

Helper method error: says is "Not a function"

I'm trying to implement a helper method in a Lightning component, but the error that comes up is: "This page has an error. You might just need to refresh it. Error during init [Action failed: c:...
1
vote
2answers
5k views

lightning callback not firing

Having in issue on my program running the setCallback. I have this one below which is working 100%: .js alert("Saving Comments!"); var saveCommentsAction = component.get("c....
1
vote
1answer
792 views

Salesforce Lightning Component TypeError evt is undefined

I have a child component to upload a file and set the file related values on the event parameters and calling that event on the parent component.The event is of application type. Whenever i click on ...
1
vote
0answers
574 views

Salesforce Lightning Component refreshes the entire page

I have a lightning component to add and remove the rows. Whenever I click the delete button, instead of deleting the selected row it refreshes the entire page. This is working fine when I tested on ...
2
votes
0answers
402 views

How to use Jasmine unit tests and still get past Lightning CLI?

Like the question says, I'm trying to work out some best practices and frameworks stuff with my team. One of the things we want to do is unit test our lightning components. I really like Bob Buzzard'...