Solved

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

Posted on 2009-04-09
5
790 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

770 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