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
0
votes
2answers
1k views

how to get current system network IPv4 Address Using Apex in Salesforce?

In my computer start<> Controlpanel<> NetworkAccoess<> details <>IPv4 Address Connection-specific DNS Suffix: Description: Qualcomm Atheros AG8161/8165 PCI-E Gigabit Ethernet Controller (...
3
votes
2answers
367 views

How to prevent SF1 from re-writing hrefs?

I'm working on an JS on VF app that utilizes hashtag routing ie: https://c.na17.visual.force.com/apex/ionicOne#app/account/001o0000006w1pBAAQ When I Access my app via Visualforce: ie: /apex/ionicOne ...
1
vote
1answer
929 views

Salesforce custom button javascript escaping error

I've noticed that SFDC is not properly escaping some characters in the code it generates to be eval'd when using javascript custom buttons. For instance, say I have an object with a field that ...
0
votes
1answer
1k views

how to use external javascript function in visualforce

javscript file : uploaded in static resource: <script> function clearValue(){ document.getElementById('{!$Component.page1:form1:autocomplete1}').value=''; document.getElementById('{!$...
2
votes
1answer
61 views

Can i IP restrict force.com pages rather than the whole site?

I haven't seen this documented anywhere so assuming this might not be doable. But lets say i have a huge force.com site and only want to have a few pages within it that are available to staff only. i ...
6
votes
2answers
2k views

Is there any way to have a formula field displayed on Standard Edit Page Layout?

I use a Standard Page Layout (Account, Contact etc). I use standard page edit view to edit and update object (like this) On Standard Display View Layout I use Formula field to display Location (as ...
3
votes
2answers
4k views

List view button to pass selected record ids on to new record for custom object

I am trying to create an easy way to mark attendance. I have a custom object "students" as well as a custom object "attendance." The attendance object is related to the student object by a lookup ...
4
votes
1answer
847 views

Upload zip file in visualforce page

Can anyone tell me how to upload a zip file in visualforce page? My use case is: I have to upload a zip file which contains 10 pdf files and assign these 10 files to 10 contacts For that how can I do? ...
1
vote
2answers
2k views

How do I fix this Stored XSS vulnerability?

The CheckMarx security scanner says that the 4th line: $j('#h{!category}').on('click', function(event) { in the following script, causes an XSS vulnerability. Can someone explain the best way to ...
4
votes
3answers
2k views

How to access custom fields in Javascript

How to access custom fields in javascript? I have Account with both standard and custom fields. I use the default Page Layout to display and edit any acc. It is necessary to populate some of fields ...
0
votes
0answers
287 views

Onclick Javascript - How to include Case Comments in the email body that is invoked through javascript mailto:

I have difficulty in getting the case comments to the body of the email when invoked through javascript through a button. I have a custom button called Send Email and when clicked on Send Email, it ...
0
votes
0answers
2k views

When we click on Button it Should generate a PDF FORM with the Ship to and Ship from details

Can anyone help me out with this requirement ?Any help is much appreciated. We do have two Buttons as GeneratePicklist and GenerateInvoice created using Execute Javascript ,ON a detail page button. ...
2
votes
2answers
1k views

pass parameter to custom label from javascript

I have a custom label that prints 'Enter at least 2 characters to search.' I would like to make the 2 a parameter that gets passed in so that the user can adjust it at their discretion. So the label ...
1
vote
1answer
2k views

Best way to make HTTP Requests

We are inserting data to a Data Extension in ExactTarget. Now on that same form submit action we have to POST that data to an Internal RESTful service (message format and responses are in JSON). Can ...
2
votes
1answer
953 views

How to show a selectlist in a visualforcepage populated with picklist values on a custom object using only javascript?

I am trying to show a selectlist in a visualforcepage populated with picklist values (from field say pickField__c) on a custom object (say object__c) using only javascript. I know how to achieve this ...
3
votes
4answers
5k views

How to compare 2 dates in JavaScript on a Visualforce page?

I have a Visualforce page in which I try to compare 2 dates. The code: <apex:page StandardController="Account"> <script> window.document.onload = new function(e) { alert("{!Account....
0
votes
1answer
258 views

Difference between logging in into salesforce sandbox with and without consuming wsdl?

I am very new to Salesforce and it's API. I am having a sandbox org and with it I have url(dev sand box ), username, password, security token and last but not the least partner.wsdl My aim was to ...
3
votes
4answers
1k views

Page does not redirect when using the action param

I am getting the error when am redirecting from the javascript it show the cross domain issue.
2
votes
2answers
1k views

ExactTarget REST API - using javascript to get accessToken

With the clientId and clientSecret, is there a way to use JavaScript to get the accessToken through ajax?
1
vote
0answers
41 views

Custom javascript is not allowed to run on Salesforce DOM [duplicate]

Recently i have created an app which uses custom JavaScript in sidebar home page component using custom links, The app works perfectly and i also uploaded it to appexchange as managed released package ...
2
votes
2answers
3k views

How to use In Operator in Sforce.Connection.query in Javascript?

I am using it like this inside scripts in VF page: var queryResult = sforce.connection.query("Select Name,Id From product2 where Id in \'" + myArray+"\'"); But I am getting malformed query error. ...
1
vote
2answers
8k views

Stop object detail page from refreshing at click of a button on embedded visualforce page

At the window.onload() event of a standard object detail page I am storing the time value in one of its fields. I have embedded a vf page along with this detail page. At the click of a button in the ...
3
votes
1answer
3k views

Record type change through Javascript

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} var orderObj = new sforce.SObject("Order__c"); var recType = sforce.connection.query("SELECT name,Id ...
1
vote
1answer
640 views

How to Add HTML / Javascript / Jquery “Slide Out” Tab (Globally)

I have a form that displays when a user selects a tab This form slides out when selected, and hides itself when selected again The action to display / hide is javascript / jquery I'd like this form to ...
6
votes
3answers
2k views

Open a visualforce page from a managed package page: URL No Longer Exists

I am trying to open a normal visualforce page (that is NOT a part of the managed package) from a visualforce page that is IN managed package. This button I have on the visualforce page in manage ...
0
votes
1answer
5k views

Assign rendered value using javascript [duplicate]

Folks, below is my code, <apex:inputtext value="{Account.Name}" rendered="True"/> <apex:commandbutton> am not using controller here, so i want to change the value to rendered="False" ...
2
votes
1answer
157 views

Display VF custom components with user-defined order

We want to allow users to add/remove modules (custom components) from a VF page and set their order of display. We will use a dialog similar to the standard SF one (see image) on the front-end and ...
2
votes
2answers
2k views

JS/jQuery for Date manipulation on VF page

Have a very simple VF page that allows the end user to either set an expiration date, or choose the number of days until the expiration. What I wanted to do was update the other field when one was ...
1
vote
1answer
170 views

Call variable from extension with JavaScript

This is my controller: public with sharing class MyController { public myObject__c myObj {get; set;} public String myObjectId; public Boolean one; public Boolean two; public ...
1
vote
1answer
2k views

How to pass String parameter to Javascript confirm() function

How could I pass to confirm() function the value of a String contained in the Controller of this VF page? <apex:page controller="TestJS" > <script language="javascript"> function ...
0
votes
1answer
2k views

Rendering <img> tag in table

I am attempting to render noImageURL when icon.image is null. For some reason, noImageURL is always rendered. It's not respecting the javascript if statement <td> <apex:image ...
0
votes
1answer
201 views

Trouble with Javascript Remoting

I'm trying to open an order as a Subtab in Service Console from a sidebar component based on the order number entered in a text box by the user. I am not receiving any error yet this doesn't work. ...
1
vote
1answer
1k views

Change color of custom button based on field value

I am trying to do the same thing as this question (set the color of a custom detail page button): Changing the color of a custom button but I want the set the value based on the value of a field in ...
3
votes
1answer
536 views

What does Sfdc.canvas() do?

I am going through Force.com Canvas Developer's Guide and I see the function Sfdc.canvas() used many places but it is not mentioned what it does exactly..Can someone give your input? For example, I ...
2
votes
2answers
2k views

Visualizing Many to Many relationship between Accounts (as Network-Structure not as Tree)

I have a many-to-many relationship between accounts. Somewhat like below: A B | | |_| C |____ | | | D E F I want to give the user a nice hierarchical view to see all the parents (including ...
1
vote
0answers
395 views

Javascript promise in visualforce page

will javascript promise work in VF page?. for me its not working while I am trying .then() function.Did anybody do anything like this? This is my code var pdf = null; PDFJS.disableWorker = true; ...
2
votes
2answers
6k views

Salesforce1 navigation - how to go to a Visualforce page?

I've done a bit of tinkering with the Salesforce1 warehouse example (tutorial 6 here). I've successfully adapted the code to work with my own custom object, and I've got records showing up as pins on ...
4
votes
1answer
264 views

Is there a way to delete record on Salesforce 1(Mobile)

Is there a way to delete a record on Salesforce 1 platform. I know there is a way navigate to sObject but if please someone could help to delete a record. Currently what i am doing to delete a record ...
1
vote
2answers
1k views

Change field visibility based on Opportunity picklist value

When i select stage picklist value as "Closed Lost" in Opportunity, then i want show text fields. By-default these text fields will be hide. I tried so many ways but i didn't get. tried using ...
6
votes
2answers
333 views

Javascript Button Issue

Full .js button code: {!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT('/resource/' & LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(NOW()),':',''),'-',''),' ',''),10) & '000/JS')...
1
vote
1answer
1k views

Display error or warning message without ApexPages using Global Component

I have a simple form , which has a output panel and pageMessage inside it . <apex:form> <apex:outputPanel id="errorPanel"> <apex:message id="msg" /> </...
1
vote
1answer
2k views

Unable parse JSON String using Javascript

I am facing issue parsing JSON String on the front-end. The parameter result represents a String function handleresult (result,event){ var newResult = JSON.stringify(result); var temp = JSON.parse(...
1
vote
0answers
113 views

Conditional Custom Buttons

I was just asked to combine 2 buttons that open 2 separate visual force pages. So my idea was to create one button(obviously). Is it possible to after that ask the user which record they want to ...
2
votes
0answers
2k views

Javascript Error : “cannot read property of Id undefined”

I have a custom button which is using the javascript code given below. I am getting the error that it is not able to get the Id. Please suggest where am in going wrong. "cannot read property of Id ...
3
votes
1answer
1k views

google map not showing on Visualforce page

I am trying a very simple exercise to display a google map on visualforce page. But nothing is showing up. Below is my page code - <apex:page controller="SampleLocation"> <head> &...
3
votes
2answers
4k views

Pass Java Script value into Apex:Input field not working

When I try to pass Java Script value into Apex:input filed no value is passed. But it works in regular html input field. Please help! . Below is my code. Which as both Apex:input & just input. ...
2
votes
1answer
675 views

Visualforce how to onSubmit via controller return error or true

I currently have a Visualforce page where a User can tick selection boxes in order to edit multiple License Voucher # Object fields as shown below. I would like to perform a field check for empty ...
2
votes
0answers
443 views

Dependent Picklists - Javascript callback

Situation Dependent Picklist fields are implemented in SFDC using a JS file called "Picklist.js". This script seems responsible for adding or removing <select> tags in visualforce pages. ...
26
votes
2answers
907 views

Javascript Remoting breaks on complex relationship data

We use Javascript Remoting to retrieve some complex data from the controller. The SOQL query looks like the following: SELECT Id, ( SELECT Id, Sales_Rep__r.Name, Customer__r.Name, ...
1
vote
1answer
644 views

How to call the controller Value in Javascript?

I want to display Popup Window in Edit Mode only, not in Read only.Could you tell me code or Suggestion ? My Code : Java script : function popup(){ var conf=confirm(" Would you like to copy ...

1
72 73
74
75 76
83