Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 425
  • Last Modified:

Results from child modal window not populating the parent window

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
SIVA1
Asked:
SIVA1
1 Solution
 
damonfCommented:
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

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now