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 ?

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

1 Answer 1

1

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

For reference Adding jQuery To Your Force.com Application

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .