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
5
votes
1answer
2k views

How to use the preChatinit method from the Live Agent API?

I am trying to get the details passed from the deployment API into the pre-chat form so that I can store some of them on fields in the record that gets automatically created. The problem is that I don'...
2
votes
1answer
277 views

“onload” like event to indicate SF page is completely loaded/rendered (incl. Related Lists)?

I have a homepage component that removes some links from the Opportunity Line Item related list items on the Opportunity detail page. I'm using the JQuery .ready() function, however this is invoked ...
3
votes
1answer
2k views

JavaScript pop up window (cross-origin frame issue)

I have button on Opportunity on click oh which i am opening a VF page window .After opening the URl becomes https://c.cs16.salesforce.com/apex/VFpage On Click of save button i am closing the opoup ...
4
votes
1answer
189 views

Custom Button not firing apex class

I need some help. I have created the following button , however when i click on the button i get the following . This is the class, which i want the button to call. Anyone have any ideas why this ...
2
votes
1answer
2k views

Custom Button to mass update Opportunity Close Dates

I'm trying out a new Custom Button with javascript for the Opportunity List View page that would extend the close date of any selected records +15 Days. I found code here that I was working to modify ...
1
vote
0answers
500 views

Google Map Issues!

Using VF i am displaying google map based on geolocation field which is a formula field(Lat_Long_Values__c) contain latitude and longitude value. When i run this VF page if there is no value in ...
4
votes
1answer
2k views

How to get the RelatedListId (rlid) of a certain related list in a custom object?

I have a Master-Detail-Relationship between two Custom Objects. In order to make our app "mobile-ready" I need to navigate with the "sforce.one" object in a VF-Page. For this I need the RelatedListId ...
1
vote
2answers
3k views

Update Total with Javascript

I am attempting to update the total of a line item in a pageblock table with javascript and cannot seem to get this to work properly. <script> function calculateTotal(qtyId, salePriceId, ...
1
vote
1answer
7k views

Calling Apex class from Javascript button: how to pass an sObject as a parameter?

I've got an apex class with a webservice method that I'm trying to fire from a custom button on the page layout of the object the method will be doing stuff to. My javascript for the custom button ...
3
votes
0answers
573 views

Trigger a native change event from within a Visualforce component

I am using the following Visualforce multi-select picklist component (thanks @metadaddy!) and extending it to handle an 'onchange' attribute: https://github.com/metadaddy-sfdc/Visualforce-Multiselect-...
1
vote
2answers
631 views

Is there a way to catch/process Visualforce input field validations?

I have javascript/jquery on a page that uses a variable from the controller that is transient. When the visualforce input field validation fails, it refreshes the page without going to the controller ...
2
votes
1answer
2k views

Parsing return from Salesforce's connection.js library

I used this post to create a button which sets a checkbox field on the Case object (see below). I wish to add simple error handling by examining the return value "result". What's a simple way to ...
2
votes
1answer
1k views

Issues with sorting on pageblock table

Hi I recently came across a jQuery animated table sorter plugin from here and I'm trying to leverage it on one of my visualforce pages. It seems straightforward enough but I can't for some reason get ...
3
votes
2answers
615 views

Remote action to display array of images

I using remote action and getting the list image url into visualforce page ie result=[photo1.jpg,photo2.jpg,photo3.jpg] Now i want to display these image with image tag as below mentioned. <div ...
1
vote
0answers
122 views

Populate fields not displayed on page with JS

I've got some script which uses Postcode Anywhere's functionality to retrieve an addresses latitude and longitude and stores them in Lat__c and Long__c custom fields. The fields are not displayed on ...
1
vote
1answer
582 views

Issue with Javascript button updates

I have a few custom buttons that we place on our page layouts that are Javascript buttons. These update a few fields on the record. I successfully created some but I am having an issue with the last ...
4
votes
3answers
7k views

Passing list from Controller to VF page

I'm trying to pass a list from controller to page and use it in Javascript as an array to form html content. But, when I pass a list of objects, an exception is thrown. Uncaught Syntax error : ...
2
votes
1answer
2k views

Use Apex Controller variable into javascript in Static Resource

I have created a vf page and added some javascript into that vf page which is using controller variable : <apex:page controller="webstore"> <script> var username = '{!username}' </...
5
votes
1answer
2k views

javascript Change div color based on controller value

I have a div which is a circle within a circle. I want the outer ( class="circle") circle to change color based on value of a number. for instance, red if greater than 20, yellow if less than 10 and ...
1
vote
1answer
616 views

Javascript Button to prompt an alert

I am trying to write a javascript button that only redirects the user if the field Data_Confirmed__c = TRUE, it it is FALSE then they should receive an alert to confirm their data first. I am not ...
3
votes
0answers
440 views

Method to determine if object loaded not using URL

I have a button in a custom sidebar object that creates a task when clicked. If an object is being viewed the task should be related to that object. If an object is not being viewed (your are on a ...
1
vote
3answers
3k views

Escaping characters within AMPscript /Javascript hybrid

We have added a javascript calendar to a page otherwise coded within ExactTarget using AMPscript.The calendar is fullcalendar.js and was impressed how easily it worked to create our lists of events. ...
2
votes
0answers
273 views

Show The first field value based on 2nd field value dynamically?

I have create a page which has picklist based on that picklist i have to show the rows and in that rows i have toshow 1st row value based on 2nd valu means level low days high ...
1
vote
2answers
2k views

Has anyone had any success using twitters typeahead.js within visualforce pages?

I am trying to get typeahead.js to work within salesforce visualforce pages. I have a basic vf page from this example, but it does not respopnd, I suspect there may be some "unknown" workaround ...
-4
votes
2answers
7k views

How To remove trailing comma(,) in array in JavaScript [closed]

var fromFields = [<apex:repeat value="{!fromFields}" var ="f">'{!f}',</apex:repeat>]; renders as fromFields =['abc','msr','mdr',]; Now I want to remove comma after 'mdr' so it will ...
3
votes
2answers
4k views

How to get Id's of field in Javascript where fields are displayed through apex:repeat tag

In Apex page I'm having 2 address sections i.e., Current Address and Permanent address but these address fields are placed in Custom setting and displaying through apex:repeat tag in page.We have a ...
3
votes
1answer
101 views

Does css and js libraries of canvas app and salesforce UI collide in anyways?

After getting so many UI issues while using canvas app i am wondering if the css and js libraries of both canvas and salesforce UI collide with each other and not recognized by the browsers? Any ...
0
votes
1answer
3k views

How to create new record from jstree using json

I would like to create the record from the jstree using context menu. Please help to resolve my issue: My Code: contextmenu : { "items" : function (node) { ...
1
vote
2answers
97 views

performing different navigational tasks from apex:SelectList

I am using a select list to navigate and perform tasks. The options are: Launch Item (opens a new page) display details, (opens a new page) view certificate, (opens a new page) review item, (opens a ...
1
vote
1answer
181 views

Return fields from custom list setting and pass to JS

If I have a custom list setting, 'Info_List__c' with 2 fields, 'Info_Field__c' and 'Info_Name__C'. What would a method look like that would iterate through the list and return all entries. And how ...
5
votes
2answers
6k views

How do I refresh Parent Window from Popup Window in Service Cloud Console

On my Case Detail page, I have a requirement of showing a Visualforce Page in a popup window when a custom button is clicked. After the user clicks the button and a opens, the user can enter details. ...
2
votes
1answer
3k views

Passing a javascript variable value to component attribute value

I have a VF custom component with attribute called chartHeight. I need to assign chartHeight a value from the VF page the component resides in, and this value should be screen.availHeight retrived ...
1
vote
1answer
2k views

Iterate over custom list setting and return all entries

If I have a custom list setting, 'Info_List__c' with 1 field, 'Info_Field__c'. What would a method look like that would iterate through the list and return all entries. And how would I call that ...
2
votes
2answers
401 views

Is there a bug in the way custom buttons handle checkboxes on related objects?

I'm creating a custom execute JavaScript button for the Opportunity detail page and trying to use an IF statement to conditionally load a resource with REQUIRESCRIPT. The goal is to base the ...
6
votes
1answer
2k views

pass blob from javascript to apex

I have an apex method that takes in a Blob input argument and needs to be called from javascript. When I pass in a Javascript Blob, I get what seems to a be type mismatch error from VFRemote.js: "...
2
votes
1answer
615 views

Restrict Month & Year value as per current date in Visualforce

I have two output field below to display drop down values of year and month. But there is no restrictions on which year and month user can select. could you pls guide me how to add an restriction so ...
1
vote
1answer
933 views

How to execute Jquery logic when inputCheckbox is checked true, but not execute jQuery when inputCheckbox is false

<apex:inputCheckbox styleClass="billCopy">Same as Above To Address </apex:inputCheckbox> <apex:includeScript value="//code.jquery.com/jquery-1.11.0.min.js"/> <script> var ...
2
votes
1answer
1k views

How to prepopulate custom fields by URL hacking?

I am able to copy and save a new custom object from a JS button in Account detail like this.. {!REQUIRESCRIPT('/soap/ajax/27.0/connection.js')} var fb=new sforce.SObject("Feedback__c"); fb.Name=...
1
vote
0answers
1k views

Need to create a new custom object record (new order) based on the current page record (current order) using custom VF

I have an Order custom object which consists of order items. Once this order is delivered to a a store for a customer, I want to add a button (on the order) that allows the employee to reorder any ...
9
votes
2answers
1k views

testing angularjs on visualforce

Doing angularjs on visualforce in a big way lately, using lots of ngforce. In all the mainstream (ie, non-force.com) angular, there's some slick unit testing stuff. But it looks like the assumption ...
4
votes
1answer
622 views

Visual Force Page Not Displayed On SalesForce1 Community Version Only

I applied my custom VF page to a global action, works perfectly internally, however, when using the community the page does not display. The page has been checked for displaying on mobile, permission ...
1
vote
2answers
201 views

Public Site is not displaying dashboard

I displayed visualforce page as public site. But as soon as I added a dashboard onto the visualforce page using the following code.... APEX public String getDashboardHtml(){ PageReference ...
2
votes
2answers
1k views

Get Current User when using forcetk.js / JqueryMobile pack

Im currently having a play with the Salesforce JqueryMobile pack and have got stuck trying to get hold of the current user Id. (Pack: http://www2.developerforce.com/mobile/getting-started/html5/#...
1
vote
0answers
698 views

Upload images to portfolio using Server Side JavaScript

I have a simple html file upload page, an example snippet of the code below. <html> <body> <form action="<ExactTarget page with ssjs file handling>" method="post" ...
3
votes
3answers
11k views

how to call the javascript function through ActionFunction?

In The below code the submitEmp() method not working can any one tell me how to call the javascript function through the ActionFunction <script> function innerJavascript(){ alert('Start ...
2
votes
1answer
8k views

How to use Javascript to validate required field entry on a VF page

I cannot and don't want to use required attribute because it is giving me so many rerendering issues as my page has so many dynamic fields based on different conditions, I am attaching the sample code....
0
votes
1answer
5k views

Jquery Validation in Visualforce Page

I need to validate the Account.Unit__c field using some jquery dialog box.But I am having difficulty in getting visual force component Id in jquery. Update I followed Keith C recommendation and ...
1
vote
1answer
1k views

HTMLElement.click() not working in IE10 for custom button

I created a custom button on the Quote object that executes JavaScript, and everything works fine except for a critical call to HTMLElement.click(). The kickers to this problem are: The button works ...
0
votes
2answers
684 views

round a value to .0 or .5

I'm looking for a way to round a value to .0 or to .5, so 1,34 would become 1.5, 1.22 would become 1.0, 1.63 would become 1.5, and 1.79 would become 2.0. Is there a function to accomplish ...
1
vote
1answer
968 views

How to prepend text to Img src value

I have this code: <td><apex:outputText value="{!e.p.Imagen_Producto__c}" escape="false"></apex:outputText></td> where the value "{!e.p.Imagen_Producto__c}" is equivalent to ...