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
151
votes
3answers
24k 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 ...
49
votes
1answer
16k 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 "...
16
votes
1answer
5k 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?
37
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 ...
45
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
47k 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"&...
25
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 ...
5
votes
1answer
8k 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 ...
14
votes
2answers
5k 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 ...
34
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: {!...
30
votes
5answers
14k 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....
13
votes
5answers
14k 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 ...
12
votes
1answer
805 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 ...
5
votes
1answer
8k views

Search functionality in lightning:datatable?

Is there a way to search across all rows/columns in a lightning:datatable to narrow down the list, just like jQuery DataTables? If so, how do implement that? Can I somehow do it all on the client-...
2
votes
1answer
1k views

How to use custom LWC lightning component in lightning-datatable

If we want to have custom lightning component in LWC lightning-datatable, for example Upload file for each of the records, how can we do that?
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
5k 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: "...
27
votes
2answers
15k 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 ...
22
votes
2answers
62k 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 ...
9
votes
1answer
7k 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="{!$...
6
votes
1answer
457 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 ...
23
votes
3answers
37k 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
9k 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}" ...
2
votes
1answer
1k views

Show alert popup on standard page layout on click of standard button “Save”

I need to implement alert popup on standard page layout on click of standard button "Save".How can i achieve it.I tried google but not getting a valid implementation.Any idea would be much appreciated....
17
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
905 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 ...
14
votes
4answers
2k views

Lightning Framework vs Standard Client Side Frameworks (i.e. React) // Which to chose when, and why?

Disclaimer Keep it objective! This one can get a little opinionated, please try to keep your answer specific to the facts a developer should be considering when choosing between two viable options ...
12
votes
3answers
964 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
13k 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 ...
6
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 ...
12
votes
4answers
11k 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="...
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 ...
3
votes
2answers
3k 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....
0
votes
1answer
493 views

How do I enqueue an action after receiving value from first action lightning controller

I have an action from which I get an Id from the server. After I get an Id from the server I want to use this vale in a second action. But I cant seen to get this to work. From My research I ...
9
votes
4answers
3k 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 ...
3
votes
1answer
2k 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
4k 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 ...
0
votes
1answer
143 views

How to capture the barcode using camera stream in visualforce page?

How to capture the barcode using camera stream in visualforce page? My requirement is, from visualforce page we need to open a camera in mobile device and i will show the barcode. with out capturing ...
19
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 ...
23
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 ...
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 ...
12
votes
1answer
3k 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 ...
17
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 ...