Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing values between Windows

Status
Not open for further replies.

mdr2273

Programmer
Sep 4, 2006
22
US
I have a form field in which a user types in an ID or a search name. I would like my onclick event for that field to open a new form (which I can do) and use the value from the form field in the new form to do a record search in ASP and then return either the ID number (if there is only one match for the name search), a list of possible records (if it's a name search) or verification that the ID number they entered is correct and show the matching name. My question is how would I transfer a form field value to the pop up window from the parent and then back to the parent from the pop up window (and then close it)?
 
if you are calling the popup window from a Javascript event then you should be able to grab the value of the field and pass it, for example in the querystring, to the new page. Alternatively, you could have the new page grab it as it loads if you need to.

This can be done using the OPENER object which refers to the window that opened the current one, if you are opening the window then assign the window to a variable name so you can use that to reference the child window from the main window.

If you need an example let me know.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005
 
mdr2273, you can pass the information on the querystring for your popup window to read and use something like:
this.window.creator.document.frmName.fldName.value=yourvalue
to write it back to the original page.

My prefered method would be to not open up a popup but to have a DIV on the same page show up absolutely positioned so it is on top of everything else. Use AJAX to test the values and present any options then hide the DIV and write the values back to whatever fields your page needs.
It is a lot cleaner than going to a new window which may be blocked by popup blockers or end up losing focus depending on what the client is doing and going into the background.

I do the very thing you are talking about. I have a form field for a persons name to go with an onclick event. When the event fires it pops up a box asking for the ID number or the persons name. The name can be first last or last, first or even partial names. We resolve the name/id against our exchange server and if based on a name there are multiple possible matches it lists them all out and the client clicks the one they want. Then the box closes, the name is written into the field and the ID#, first name, last name and email addresses are all written to hidden form fields for later use.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top