Solved

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

Posted on 2009-04-09
5
816 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

635 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