Click here to Skip to main content
12,945,800 members (54,206 online)
Click here to Skip to main content
Add your own
alternative version


26 bookmarked
Posted 2 Jul 2002

Using popup windows to send server information back to the client

, 2 Jul 2002
Rate this:
Please Sign up or sign in to vote.
A Frill-free way to submit Forms and Parent-Child window communication
<!-- Download Links --> <!-- Add the rest of your HTML here -->


Very often we come across sites that carry Feedback Forms, Reader Rating Forms or Newsletter Submission Forms. Once the user submits the Form, he is either led to a different page or the current page is refreshed. This maybe distracting sometimes.
Surfers typically have a short attention span and if you were looking for a frill-free way to submit the form so that user's attention is not diverted by the page reload ,from the other goodies on the site, then read on...... handles this issue neatly with its Book marking feature. Besides other things, has a Free Library and lots of informative articles for subscribers (its free and btw I don't work for them). There is a 'Save' link at the top of each article which bookmarks that particular page on the site for future reference. The 'Save' link when clicked, opens up a nice little child window indicating that info has been saved. Presumably this child window page is an ASP script that saves the link info to the Personalized settings database.

The source code presented here shows a simple example of how to submit a Form , that maybe contained in a typical database Editing page, so that the Action page of the Form opens in a new Child window and more importantly updates the edited values in the Parent window FROM THE CHILD WINDOW. The idea can be extended to update the database after Form submission without actually disturbing the page that contains the Form.

Source Code

The zipped file contains a HTML file, dad.html and an ASP script, kid.asp. You will need IIS or PWS on your workstation to call the HTML page using HTTP. When you type a number in the Form in dad.html and submit, a child window pops up which shows the number you typed and does a bit of voodoo and changes it to 13. Using the Form on kid.asp you can again change the number on the parent page, dad.html.

To submit the Form so that the Form Action page opens in a new window, this is what you have to do.......

<FORM name="f1" action="kid.asp" method=POST target='kid' onSubmit='pop()'>

Set the TARGET attribute to 'kid'. TARGET represents the name of the window or frame that is to receive content returned by the server after the form is submitted. 

The Javascript function pop opens up a Child window with the help of the  method

function pop()
var newWin;
The method requires 3 parameters., windowName,windowFeatures)

The following window Features can be optionally chosen and each has to separated by a comma :

Moving onto kid.asp, the number you typed is displayed with a Response.Write, after the Form value is fetched using the Request.Form method.
Let me reveal the black magic that changes the number you typed to 13. The function change that is called in the BODY onLoad event of kid.asp accomplishes that. Of course, if you chose to type 13 you won't notice any change!
function change()

If you wish to change the number in the Textbox in the Parent window, the tellDad() function in the onClick event of the button will do it for you

function tellDad()


Go ahead, run the code and then rate it. I'll appreciate any kind of feedback on this article.



This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

'Anil' Radhakrishna
Web Developer
India India
'Anil' Radhakrishna is a seasoned developer who enjoys working with Microsoft tools & technologies. He blogs quite regularly about his little discoveries and technical experiments on his blog called Tech Tips, Tricks & Trivia. He loves building mash-ups using public Web APIs.

You may also be interested in...


Comments and Discussions

Generalmulticast ftp code in java Pin
ab3li22-Jun-05 0:19
memberab3li22-Jun-05 0:19 
Generalposting more than one value Pin
lgm3K9-Mar-05 9:43
memberlgm3K9-Mar-05 9:43 
QuestionGrabbing values with VBScript? Pin
a_soong21-Nov-03 12:17
membera_soong21-Nov-03 12:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170518.1 | Last Updated 3 Jul 2002
Article Copyright 2002 by 'Anil' Radhakrishna
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid