Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

post form1 to pop up window > post form2 on popup to self > change value form3 to main window.

Posted on 2003-02-19
4
Medium Priority
?
272 Views
Last Modified: 2009-12-16
Ok here goes!

I have a form (form1) in a main window (lets call it window no.1) that posts date values that will be calculated on a pop up window (window no.2).

Here is the code for the pop up:

<script language="JavaScript">
<!--
               function openWin(wName, wWidth, wHeight, wResize)
               {
                 features = 'scrollbars=1,status=0,resizable=' + ((wResize) ? 1 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '');
                 popWin = window.open('', wName, features);
        if(popWin.focus) { popWin.focus(); }
        return true;
               }
          // -->
</script>

<form action="/PriceCalculator/popup.asp" method="post" name="CheckAvailibilty" target="newWin" onSubmit="return openWin(this.target, 370, 400, false)">

On the pop up I have a similar form (form2) that posts the values to the same page. I need some of the returned values to be 'inserted' to a seperate form (form3) on my original window (window no. 1) through a hyperlink without closing the pop-up window and without posting the page.

Somehow the first page (form and form field) needs to be referenced when opening the first pop-up I think.

I hope the above is clear. Any help will be appreciated.

Regards, Storm

0
Comment
Question by:Stormvdm
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 800 total points
ID: 7980861
Hello Storm,

normally is for this purpose the window property "opener" to be used. But I assume this property is not correctly available after your popup window is filled by the subsequent html receive.

So is my proposal to access this opener window and their forms contained in opener window by naming the opener window with a distinguish name.

Like this:
<script language="JavaScript">
<!--
              function openWin(wName, wWidth, wHeight, wResize)
              {
                features = 'scrollbars=1,status=0,resizable=' + ((wResize) ? 1 : 0) + ((wWidth) ? ',width=' + wWidth : '') + ((wHeight) ? ',height=' + wHeight : '');
                popWin = window.open('', wName, features);
       if(popWin.focus) { popWin.focus(); }
       window.name="openerWindow";
       return true;
              }
         // -->
</script>

So you can reference in your popup html script like this:

top.openerWindow.document.formName.fieldName.value="xxx";

Give it a try.

Good luck,
Zvonko

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 7980876
Oh, this opener window naming is possible because you can handle window collections like frames.
The window name is then the frame name.

0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10081745
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:

 - [Points to Zvonko Grade A]

Please leave any comments here within the next seven days.
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************

jAy
EE Cleanup Volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

581 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