Solved

Get the Returned value from a JavaScript showModalDialog then close the dialog.

Posted on 2009-04-09
5
785 Views
Last Modified: 2012-05-06
I am trying to return the showModalDialog's returnValue.  In the aspx page that I'm using for my dialog, I'm trying to set the window.returnValue then close the dialog.  When I run this I get an error stating that the property returnValue doesn't exist in the current object.  How on earth am I going to get the return value out of the dialog if the returnValue doesn't exist?  I am doing this in a .NET 1.1 web application.

All I want to do is call the dialog to confirm something with a "Yes" or "No" response then close the dialog and pass the value back to the calling page.

Please advise.
Here is the JavaScript to call the dialog:

var retVal = window.showModalDialog(dialogURL, args, options);									

if (retVal != null)

{

	if(retVal.split(',')[1] == true)

	{

		bolReturn = true;

	}

	else

	{

		bolReturn = false;

	}

}
 

Here is the script in the dialog page:

function Confirmation(choice)

{

	try

	{

		returnValue = choice;

	}

}

Open in new window

0
Comment
Question by:pldougless
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:rbradberry
ID: 24110380
"returnVallue = choice;" should be "window.returnValue = choice;"

also, this is an IE only function, it will not work in FireFox
0
 

Author Comment

by:pldougless
ID: 24110414
Sorry, the code should have reflected window.returnValue.  I have tried "window.returnValue" and get the error when I do.  Also, when coding and using intellisense I don't see the returnValue member in the window object...it simply isn't there.
0
 
LVL 3

Expert Comment

by:rbradberry
ID: 24110519
are you calling that function from within the window?  window.returnValue is only available after the windows has closed.
0
 
LVL 3

Accepted Solution

by:
rbradberry earned 125 total points
ID: 24110536
basically you have to set the window.returnValue from within the window while it is open.  then you can only retrieve the value of after the window has closed.
0
 

Author Comment

by:pldougless
ID: 24110654
I am trying to set the window.returnValue in the dialog before it is closed...here is what I doing in the windows script:

Here is the script in the dialog page:
function Confirmation(choice)
{
      try
      {
            window.returnValue = choice;
            window.close();
      }
}

The error is encountered saying that the returnValue property doesn't exist.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now