PDA

View Full Version : closing the dialog from child page; How?



noname
13 Jun 2007, 10:45 PM
Hi all,

I have an ext. dialog loaded with a child page. If submit is successfull, I want to close this dialog and show a message box. I am doing the form submition on AJAX and it will return a string , by checking the string I show/close the dialog and display message box. here my problem is how can I invoke the dialog.hide() method of the parent page?

let me know if this method is right, if not please suggest another method.

Thank you,

DigitalSkyline
14 Jun 2007, 12:12 AM
You need to have access to the dialog object (i.e. the correct scope). This can be done by making your dialog instance a global variable (probably frowned upon, but it works).

Your loaded page needs to have the flag scripts:true and remember the scripts will be parsed inline. I'm assuming your not using an iframe, otherwise you need to invoke it like parent.yourobject(); Check the pinned thread on scope.

ex. inline code:


Ok = function(){
dialog.hide();
return false;
};
dialog.addButton('Ok', Ok);
dialog.addButton('Close', dialog.hide, dialog);

noname
14 Jun 2007, 6:42 AM
I'll try it,

Thank u very much.

noname
16 Jun 2007, 10:16 PM
Thank u ver much DigitalSkyline,

Now it is working,

I am using an iframe, and I called the function from parent page,
Still I am not clear about flag scripts:true, what is the significance of doing this?
Just asked to make my ideas better.

Thanks again dude!

DigitalSkyline
17 Jun 2007, 12:09 AM
Depends on the application but you don't always need to use an iframe, script:true parses the scripts when you load html from a url.