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.

147
votes
3answers
23k views

End of javascript sidebar workarounds? (Salesforce Classic / Aloha)

Reading through this doc: Docs.releasenotes.salesforce We replaced the rich text editor in HTML Area home page components with a new version that supports more markup but doesn’t allow HTML to ...
48
votes
1answer
14k views

How do I start to debug my own Visualforce/JavaScript?

This question is intended to complement How do I start to debug my own Apex code? as sometimes questions are asked here that could most easily sorted out by the questioner using their browser's "...
36
votes
6answers
4k views

Why do we still need to hack the Sidebar? Usecases - Workarounds - Alternatives

Since it seems to me, that a lot of people still need sidebar workarounds, I would be interested to learn about the use-cases, experienced challenges and (most important) possible strategies to avoid ...
14
votes
1answer
4k views

Which external Javascript libraries work with Lightning Locker Service?

Components often seem to work with external libraries until the Locker Service is enabled. What libraries work with locker service enabled and where can I go to find out?
44
votes
2answers
9k views

Changing the color of a custom button

Is there a way of changing a custom button color? Not a button on the visualforce page but rather the ones created under custom and links on an object. Thanks. -K
15
votes
1answer
45k views

How to pass javascript value to controller..?

I want to pass the java-script value to controller.I am using repeat on VF page. VF page <apex:repeat value="{!listAdj}" var="Adj" id="hrs"> <td><div class="requiredInput"&...
24
votes
6answers
26k views

How can I execute JavaScript on a SFDC Standard Detail Page?

*NOTE: This is not feasible as of the latest SFDC Releases. * I have a requirement to execute some JavaScript on a SFDC Standard Detail page. Specifically we would like to remove the ability for ...
14
votes
2answers
4k views

How do I call functions loaded from a Static Resource JavaScript file?

I'd like to put some shared Javascript to Resource file to reuse it between several components. This Javascript is general purpose set of utility functions. However, functions from my resource file ...
32
votes
4answers
6k views

Namespace Prefix in JavaScript and Apex within Installed Package

When you have a dedicated Visualforce Page and can use modern JavaScript Remoting techniques, this is seldom an issue. But I'm looking at some historical code in a managed package like this: {!...
29
votes
5answers
13k views

Lightning: Bug in Lightning framework when using aura:renderIf?

I have a Nav component which contains the following: <aura:renderIf isTrue="{!v.showAllProducts}"> <c:showAllProductsCmp/> <aura:set attribute="else"> <c:...
14
votes
2answers
3k views

Lightning: is direct API access on the roadmap?

I'm programming developer tools and an IDE. Right now, my code is based on Visualforce and JavaScript. As described here, I would like to convert most of my API callouts form APEX to JavaScript. Also ...
6
votes
1answer
2k views

What is the best way to debug Lightning Components (used in the Community Builder)?

I have a lightning component elfTest1 used on a page elf. The page itself is used as internal URL in the community builder wired via the menu. Now in case of a JavaScript error in elfTest1Controller....
0
votes
1answer
5k views

How can one validate 'recordEditForm' fields before submitting them to the platform?

In a custom lightning component where one is using the recordEditForm tag, how can one validate fields that are filled by the user? For example, in a quick action to create a Case record, we can have ...
13
votes
5answers
13k views

How to call Apex REST API from Javascript?

I have two different developer orgs. One contains apex REST web service, and I want to call that REST service from my second org. I have tried to call that REST service using normal ajax post request ...
10
votes
1answer
650 views

Examples of use of getValueProvider

I was looking through the AuraDocs reference today and found a function on the Component javascript API that I had not seen before: addValueProvider (String keyObject valueProvider) Adds ...
10
votes
1answer
61k views

iframe: Protocols, domains, and ports must match error

I have an VF page with an iframe displaying a force.com site from a different SF instance and I'm receiving this error in chrome caused by SfdcCore.js: Blocked a frame with origin "https://<...
2
votes
3answers
4k views

Get dateformat based on Locale

i am trying to fetch the date format for the logged-in User in javascript on visualforce page. Usually I used to get this data by using: window.UserContext.dateFormat Expected Output should be: "...
26
votes
2answers
14k views

Custom labels in javascript

How one can access custom labels in javascript linked as separate static resource? For example, some user action on the page should trigger confirmation dialog with custom message. And this message ...
19
votes
2answers
60k views

XMLHttpRequest cannot load, No 'Access-Control-Allow-Origin' is present

We have a customer who is having a problem with the embedded visualforce page for their custom objects that include our component. The issue is with the Cirrus_Files_Dog visualforce page. The page is ...
8
votes
1answer
6k views

Lightning Components: How to make sure that a script loaded via ltng:require is loaded in aferRender()?

I'm trying to load jquery and use it for dom manipulation. Therefore I need to find the right place to invoke the $() call. In the component, I load jquery like this <ltng:require scripts="{!$...
7
votes
1answer
432 views

Native JS Map prototype is overwritten in Visualforce page w/ a header

I've been exploring implementing Angular 2.0 in Salesforce custom pages and found that if I set showHeader=true in the VF page, I run into some issues. It looks like including the header loads "sfdc/...
5
votes
2answers
1k views

Soft error in Standard Salesforce page

I have a requirement of showing a pop up (soft error) that will show a message when account information is not filled in the page. This is a salesforce standard page and hence there is no VF code ...
4
votes
2answers
4k views

How to do a javascript button in Lightning?

We depend on a javascript button to allow our salesforce screens to interact with another web application. We read some elements from the salesforce contact, and then call a js func hosted on another ...
21
votes
3answers
35k views

access controller variable in javascript

Is there any way to access controller variable set in a Method in Javascript. In the example above the value is set in constructor. But when I set it in a method it is showing as NULL in Javascript ...
4
votes
2answers
8k views

Call apex method and JavaScript from html button

I have a custom search page for use in Customer Portal. VF Page: <form name="frmSearch"> <input type="text" name="keyword" id="keyword" value="{!portalSearchModel.searchTerm}" ...
16
votes
5answers
5k views

Javascript remoting and apex date design pattern

I'd like a clever way to handle this in all my code from now on. I have some existing methods that do date calculations in apex...some use the businessHours object and some don't. Many surface ...
5
votes
1answer
880 views

What navigation pattern for Lightning Community created be the new Community Builder could be recommended?

I'm not sure what navigation pattern is best for Lightning Communities. Use case is a quite simple: ListView => DetailView navigation hosted on a community page. Reading through @DougChasmans example ...
5
votes
1answer
4k views

VF Page: Best way to avoid datepicker focus on load?

I have two date fields on my Visualforce page and on occasions the datepicker/calendar pops up upon page load. I understand one way to prevent this is to use javascript as suggested below: <input ...
13
votes
3answers
905 views

Salesforce Breaking Javascript Console?

Problem Statement I worked out a neat script to run in the Chrome DevTools console to make a configuration process faster. I went into my sandbox to reproduce the behavior so I could write it up in a ...
7
votes
2answers
5k views

Using jQuery with apex:tabPanel in visualforce

I am using jQuery library in my visual force page, but I've faced a major problem when I tried to use tabs "apex:tabPanel". <script src="{!$Resource.jQuery}"></script> <!-- If I delete ...
7
votes
3answers
12k views

How to refresh the parent window after opening a pop up window from inline page?

I opened a Popup from an inline VF page in SFDC and then after some action I was able to close the window but needed a refresh of the Top window from inline frame . My code is as below for opening a ...
12
votes
4answers
9k views

Winter 17 release : event.getSource is not a function on lightning:button

I'm trying to get the label of the button the user has clicked on by using event.getSource, but I'm getting the error that event.getSource is not a function. Component <lightning:button variant="...
5
votes
1answer
3k views

Apex JSON.serialize() with null values (RELOADED)

I need to serialize a list of SObject without omission null values. This string I need for a later usage in JavaScript. Structure is crucial, because I need to construct a table out of it. The ...
3
votes
2answers
2k 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
4answers
3k views

Inline editing doesn't update last edited value without control loosing focus first

When I double click on the output field and try to change the field value. The updated value is not getting saved when i directly click on save button. Instead, In order to save record I need to ...
0
votes
2answers
792 views

Quick Action using Visualforce - modal dialog width

When you use Visualforce page as Quick Action and modal popup window opens - it occupies 50% of container width. According to Create Object-Specific Quick Actions article For a Custom Visualforce ...
9
votes
4answers
2k views

(MS Edge) Error when accessing window.location in lightning components with LockerService enabled

My lightning component (V40/SU17) errors out when accessed via MS Edge with LockerService enabled. Is there a different method of accessing the window.location? WindowLocation.cmp <aura:component ...
2
votes
2answers
1k views

Why are my JavaScript objects equal to Proxy {}

I am loading a JavaScript object between Lightning Components var model = {} model.user = {} model.caller = {} model.caller.name = 'Batman'; model.other = {} // etc And then into component ...
2
votes
2answers
3k views

$A.get(“e.force:navigateToSObject”) returning null

I am trying to use the "navigateToSObject" to redirect to the detail page. But the method $A.get("e.force:navigateToSObject") is always returning null. I dont have a namespace. SO this isn't namespace ...
18
votes
3answers
8k views

Feasibility of Angularjs in visualforce pages?

Is it feasible to build visualforce pages with angularjs? Visualforce is itself a MVC framework. It has its own data-binding, data-transfer mechanism through viewstate. If angularjs is used, what ...
14
votes
1answer
2k views

Access MetadataAPI via JavaScript

We created an 100% native Salesforce IDE as a Managed Package which is using ToolingAPI and MetadataAPI via APEX. This works fine. But there is one thing which really bothers people after the ...
21
votes
3answers
5k views

Javascript Remoting in Static Resource

Is it possible to call javascript remoting in a static resource? I'm creating an AngularJS application, and to stick with best practices I would like to put my services in separate files. Theses ...
12
votes
1answer
2k views

Lightning Components: why are subsequent invocations of $A.enqueueAction() so super SLOW?

I have an Lightning Component with an controller containing a sever side APEX-action like this @AuraEnabled public static Object myServerSideAction_1() { return null; } @AuraEnabled public static ...
8
votes
2answers
3k views

End of Sidebar workarounds via Messages & Alerts and Custom Links finally in Winter or Spring '16?

There was an update in a partner alert about the HTML home page components on February 27th. Now two sentences has been added to this paragraph: With the Summer '15 release*, Salesforce will no ...
16
votes
1answer
10k views

creating a popup panel on a standard detail page layout

We currently use the lead detailed page to display lead information. We have a requirement where we need to create a custom button on the lead detailed page on the standard layout where on clicking ...
13
votes
1answer
513 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 ...
10
votes
2answers
2k views

Shared Helper Code in Lightning Components

I feel like I am duplicating a lot of javascript code while creating helpers for different but related components. Is there a way to have like a shared helper, or maybe a global helper. What other ...
9
votes
2answers
3k views

What is the Function of aura:dependency?

I came across something that vastly improved the performance of the Lightning application that I am building. However, I am not sure exactly why. When my application initializes, I am calling a doInit ...
7
votes
2answers
3k views

Return Boolean From Action Function called from JS

I have a page which displays a bunch of input fields for a record (fairly standard) and allows the user to update those fields and then save the record. On the bottom of the page there is a command ...
7
votes
2answers
2k views

Using static resources in OnClick Javascript buttons after “Serve Static Resources from force.com domain” critical update

We're using list view and details OnClick Javascript buttons which reference custom js ans css files stored in static resources and containing some shared logic/styles. The sample code below ...