2

I have created a custom button on Account layout to test popping up a jQuery modal dialog box.

{!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')} 
{!REQUIRESCRIPT('/js/functions.js')} 
{!REQUIRESCRIPT('/resource/jQuery/jquery-1.8.2.min.js')} 
{!REQUIRESCRIPT('/resource/jQuery/ui/jquery-ui-1.9.1.custom.min.js')} 

requireCssFile('/resource/jQuery/ui/css/ui-lightness/jquery-ui-1.9.1.custom.min.css'); 

function requireCssFile(filename) { 
var fileref = document.createElement('link'); 
fileref.setAttribute('rel', 'stylesheet'); 
fileref.setAttribute('type', 'text/css'); 
fileref.setAttribute('href', filename); 
document.getElementsByTagName('head')[0].appendChild(fileref); 
} 

var j$ = jQuery.noConflict(); 

var j$modalDialog = j$('<div></div>') 
.html('Be Apex my friend!') 
.dialog({ 
autoOpen: false, 
title: 'My Modal Dialog', 
resizable: false, 
width: 400, 
height: 400, 
autoResize: true, 
modal: true, 
draggable: false 
}); 

j$modalDialog.dialog('open');

I have been following this article as to how to issue a jQuery modal dialog box from Standard Page Layout.

http://www.valnavjo.com/blog/modal-dialog-on-a-standard-salesforce-page/

Upon clicking on this custom button I am getting the following error.

enter image description here

Can someone let me know what is the issue ?

  • 1
    you are trying to access the jQuery from your static resources....did you have jQuery libraries (zip folder) in your resources? – sam_s Feb 2 '16 at 2:34
  • That was it..Forgot to add them ..thanks..you can put as answer – Rainmaker Feb 2 '16 at 2:47
1

You need to have jQuery libraries included in your static resources file.

For reference Adding jQuery To Your Force.com Application

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.