I am using simple dialog for showing some custom popup having a iframe in it whose source is a VF page. Below is the code i am using for it in Javascript.
function openDialog(var1,var2){
if (var1 != null && var2 !=''){
var pageURL = '/apex/myVFPage?id='+var1 +'&name='+var2;
var sd = new SimpleDialog("Test", true);
sd.setTitle("Message From Webpage");
sd.createDialog();
window.parent.sd = sd;
sd.setWidth("50%");
//Specify the iFrame and give URL of VF page
sd.setContentInnerHTML("<iframe src="+pageURL+" style='border:1;wiidth:460px; min-height: 170px' ></iframe>");
if ($j(sd.dialog).find('#InlineEditDialogX').size() == 0) {
var close = $j("<a id='InlineEditDialogX' title='Close' tabindex='0' href='javascript:void(0)' class='dialogClose'>Close</a>");
close.mouseover(function() {
this.className = 'dialogCloseOn';
}).mouseout(function() {
this.className = 'dialogClose';
}).click(function() {
// finally our on click handler which closes the dialog
sd.hide();
});
// insert the new generated close button before the h2 tag so it'll show up on the top right corner
close.insertBefore($j(sd.dialog).find('.topLeft h2'));
} sd.show();
}
}
I am calling this javascript function from my VF page button.
How can i close the dialog box from my iframe's VF page. And re-render my parent VF page to new href from the child VF page(i.e. in the iFrame).