function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ram VaidyanathanRam Vaidyanathan 

Open a JQuery Dialog in Standard Account Page

Hi there.

   I need some help, I want to open a JQuery Dialog in Standard Account Page.

 

-Ram

Best Answer chosen by Admin (Salesforce Developers) 
paul-lmipaul-lmi

you'd only be able to do it in the context of the iframe that'd be used when embedding a visualforce page.  we tried to do this a while ago, and the ultimate limitation is that because visualforce runs on a different domain than the standard salesforce UI, you can use jquery to do anything that'd alter the parent page (in this case, the account page).  we ended up launching a standard popup instead.

All Answers

paul-lmipaul-lmi

you'd only be able to do it in the context of the iframe that'd be used when embedding a visualforce page.  we tried to do this a while ago, and the ultimate limitation is that because visualforce runs on a different domain than the standard salesforce UI, you can use jquery to do anything that'd alter the parent page (in this case, the account page).  we ended up launching a standard popup instead.

This was selected as the best answer
d3developerd3developer

Really? :)

 

What about this:

 

 

$("#popup", parent.document.body).dialog('open');

 

 

You'd have to ensure the content was on the parent page, however, although you could also find an existing element page, append  the content you want, then open it as a popup. 

 

Paul -- how did you get the standard popup to work? Wouldn't that have the same problem?

paul-lmipaul-lmi

we just used window.open instead of a jquery modal/lightbox.  since jquery would try to modify the DOM of the parent, and that's not allowed across different domains, I'm pretty sure any other approach will fail unless security settings are lowered in the browser.

d3developerd3developer

ah, sorry didn't get the cross domain bit before but makes perfect sense.

Ram VaidyanathanRam Vaidyanathan

So here is what I did,

 

   1) Opened the Visualforce page as a popup window using Javascript (window.open)

   2) Once we hit save/cancel in the visualforce page, I set a variable and closed the vf page using JS and refresh the parent window,

 

   if("{!$Request.success}" == "true") {
        parent.window.close();
        parent.window.opener.location.href = "/{!$Request.id}";          
    }

 

-Ram