Javascript ShowModalDialog return info to the parent

Posted on 2006-05-11
Medium Priority
Last Modified: 2008-01-09

This should be an easy answer for you to answer.  but it is urgent so I am going to give 500 points.

I would like to use the ShowModalDialog for returning information to the parent window.  Is this possible?  I did come across the following statement:

myReturnValue = showModalDialog('template.html',[calen,self],boxFeatures);

but the description says that the box uses script template from the parent???

would it also send back the contents of a form field?

does anyone have any ideas as to how this would work?

I do have another question and that is the parameters for the showmodal is URL, Arguments, boxfeatures
I read on the microsoft web-site that the arguments can be used for sending objects, why couldn't you send a complete web-page as an argument?

can you please provide examples?

Thanks very much in advance

Question by:ralphsauto
LVL 17

Accepted Solution

gops1 earned 2000 total points
ID: 16673403
try this

Inside parent page:

function openModal(){
 var retVal=showModalDialog('a.html','Passing this Vlaue','dialog window properties');
 alert('modal returned value="'+retVal+'"');
<input type="button" value=" Open Modal" onclick="openModal()"/>

Inside a.html (modal window) page:
function getInfoFromParent(){
var PassedString = window.dialogArguments;
document.getElementById("fromParent").innerText = PassedString;
return value="from child";

<body onload="getInfoFromParent();">
<span id="fromParent"></span>

Author Comment

ID: 17505533
Sorry, got my answer and forgot to award the points

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question