Solved

Results from child modal window not populating the parent window

Posted on 2004-09-29
3
414 Views
Last Modified: 2013-12-10
hi,
 
I HAVE PECULIAR PROBLEM IN MY websphere - struts APPLICATION.

i HAVA A MAIN PAGE WITH A BUTTON. WHEN I CLICK ON BUTTON A MODAL WINDOW IS OPENED. i NEED TO FEED THE DATA AND SUBMIT IT. As soon as i click submit the main page is again opening in new window.

Please suggest how to avoid opening new window and also I want to refresh the main page with new results.

It is really urgent. iF POSSIBLE PUT THE COMPLETE CODE

Advance Thanks
0
Comment
Question by:SIVA1
3 Comments
 
LVL 7

Accepted Solution

by:
damonf earned 500 total points
ID: 12190292
Yeah, right ... put the complete code.  Listen, I can help but with what you've given, how could anyone put complete code?

Here's the issue:  if you are using a modal window from IE's showModalDialog method, you simply cannot submit the page to itself.  You have two options:

1)  if you want the modal window to stay open, you have to put a hidden frame like an iframe there and load the page inside the iframe.  Then you can submit normally.

2)  if you just want to submit data back to the main page, you have use the showModalDialog properly.  You pass an object to the modal window via the second argument.  Inside the modal window, you can manipulate the object with javascript and send it back.

Like so:

In main page:

<script language="javascript">
function doIt(){
myVar = new Array("xxx");
alert(myVar[0]); //says "xxx"
result = showModalDialog("myPage.html",myVar);
alert(myVar[0]); //says "yyy"
}
</script>
<input type="button" onclick="doIt()">



In modal:

<script language="javascript">
function doIt(){
newVar = window.dialogArguments;
alert(newVar[0]); //will say "xxx";
window.dialogArguments[0] = "yyy";
window.close();
}
</script>
<input type="button" onclick="doIt()">



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

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
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.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

13 Experts available now in Live!

Get 1:1 Help Now