Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to send multiple data from popup window to main.asp using javacript/vbscript?

Posted on 2008-06-26
3
Medium Priority
?
571 Views
Last Modified: 2008-07-05
<html><head><title>Main</title>
<script language=javascript>
function OpenCalculator() {
newdata = window.showModalDialog('2.htm','','dialogWidth:300px;dialogHeight:175px;help:No;resizable:No;status:No;center:yes' );
}</script>
</head> <body><center>
<font color=red>Copy data from popup page<br>
<input type=text name=A size=3 readOnly onclick ="OpenCalculator();" style="cursor:hand">
<input type=text name=B size=3 readOnly ><input type=text name=C size=3 readOnly >
<input type=text name=D size=3 readOnly ><input type=text name=E size=3 readOnly >
</body> </html>
============================================
<html><head><title>New Page 2</title></head>
<body><center>
Send data from this page to Main<br>
<input type=text name=A1 size=3 ><input type=text name=B1 size=3 >
<input type=text name=C1 size=3 ><input type=text name=D1 size=3 >
<input type=text name=E1 size=3 ><br>
<input type=button name=DT value=press>
</body></html>
0
Comment
Question by:zubama
[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 Comments
 
LVL 7

Expert Comment

by:Dauhee
ID: 21877960
0
 
LVL 2

Expert Comment

by:pvialatte
ID: 21882292
Hello,

you can send some data by javascript to your parent window
for this, you need to add a reference to the opener in the showModalDialog call

newdata = window.showModalDialog('2.html', self,'dialogWidth:300px;dialogHeight:175px;help:No;resizable:No;status:No;center:yes' );

(just replaced '' by self)

Then, in the popup dialog, add the following function
<script language=javascript>
function CloseCalculator() {
var opener = window.dialogArguments;
opener.A.value=A1.value;
....
opener.E.value=E1.value;
  window.close();
}</script>

Full script below


<!-- main.htm -->
 
<html><head><title>Main</title>
<script language=javascript>
function OpenCalculator() {
window.showModalDialog('2.htm', self,'dialogWidth:300px;dialogHeight:175px;help:No;resizable:No;status:No;center:yes' );
}
</script>
</head> <body><center>
<font color=red>Copy data from popup page<br>
<input type=text name=A size=3 readOnly onclick ="OpenCalculator();" style="cursor:hand">
<input type=text name=B size=3 readOnly ><input type=text name=C size=3 readOnly >
<input type=text name=D size=3 readOnly ><input type=text name=E size=3 readOnly >
</body> </html>
 
<!-- 2.htm -->
<html><head><title>New Page 2</title>
<script language=javascript>
function CloseCalculator() {
var opener = window.dialogArguments;
opener.A.value=A1.value;
opener.B.value=B1.value;
opener.C.value=C1.value;
opener.D.value=D1.value;
opener.E.value=E1.value;
  window.close();
}</script></head>
<body ><center>
Send data from this page to Main<br>
<input type=text name=A1 size=3 ><input type=text name=B1 size=3 >
<input type=text name=C1 size=3 ><input type=text name=D1 size=3 >
<input type=text name=E1 size=3 ><br>
<input type=button name=DT onclick ="javascript:CloseCalculator();" value=press>
</body></html>

Open in new window

0
 

Accepted Solution

by:
zubama earned 0 total points
ID: 21882982
I solve the problem. Thanks.
<HTML> <HEAD> <title>WebForm</title>
<script language=javascript>
function PopUp(){
var SelectedValues = document.all("Text1").value + "|" +
document.all("Text2").value + "|" + document.all("Text3").value + "|" +
document.all("Text4").value + "|" + document.all("Text5").value
var Newdate = window.showModalDialog("PopUp.htm?parm="+SelectedValues, '','status:No;");
if (Newdate!=undefined) {      var x = Newdate.split('|'); document.all("Text1").value = x[0];
document.all("Text2").value = x[1]; document.all("Text3").value = x[2]; document.all("Text4").value = x[3];
document.all("Text5").value = x[4]; }  
}  </script> </HEAD>
 <body> <form id="Form1" method="post" runat="server">
<INPUT type=text size=4 name=Text1><INPUT type=text size=4 name=Text5><INPUT type=text size=5 name=Text4><INPUT type=text size=4 name=Text3 ><INPUT type=text size=2 name=Text2>
<INPUT type=button value=Button name=Button1 onclick="PopUp();">
 </form> </body></HTML>
======================================================
<HTML><HEAD><title>PopUp</title>
<script language=javascript>
function CloseMe()   {
var SelectedValues = document.all("Text1").value + "|" +
document.all("Text2").value + "|" + document.all("Text3").value + "|" +
document.all("Text4").value + "|" + document.all("Text5").value
window.returnValue=SelectedValues; window.self.close(); }
</script></HEAD>
<body><form method="post"><INPUT type=text name=Text1><INPUT type=text name=Text5><INPUT type=text name=Text4 ><INPUT type=text name=Text3><INPUT type=text name=Text2><INPUT type=button value=Button name=Button1 onclick=CloseMe();></form></body></HTML>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

636 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