Jump to content

Return data to parent window after multiple child pages


cmattoon

Recommended Posts

I have a main window for entering information, one field is "patient name". Next to this field is a link that opens up a window via JavaScript.

 

When I have a simple form (textbox, submit), it returns (child.textbox.value) to (mainwindow.textbox.value).

 

The purpose of this "lookup" function is to search the database for patients with a last name of, say, Smith. It returns a table of all patients with a last name of Smith (also DOB, SSN, etc)

 

Smith  John  123-45-6789  12/31/1969

Smith Mike  234-56-7890  01/01/1970

etc...

Next to each name is a checkbox, with a unique patient ID number as the value. This value and $lname.", ".$firstname should be returned to the main window.

 

Main window >> Search for Patient >> Search Results/Select Patient >> Main window

 

When I use two pages, it doesn't work.

 

Main Window: (not sure what "Ratting" means... was in the sample code

<input name="pt_name" type="text" id="pt_name" size="30" /><a style="font-size:x-small" href="javascript:void(0);" NAME="searchpt" title=" Patient Search " 
onClick=window.open("searchpt.php","Ratting","width=550,height=170,left=150,top=200,toolbar=0,status=1,");>
Lookup</a>

 

Search For Patient:

<form method="post" action="../child_search.php">
(Input Text, Submit)

 

Child_search.php: (The "frm" and action="") are exactly as laid out in the example, which works.

I've also tried using the original code, which was just using "opener.document" instead of "mainWindow.document". The mainwindow body tag has an id/name of "mainWindow"

	<script langauge="javascript">
function post_value(){
mainWindow.document.form1.pt_name.value = document.frm.fullname.value;
mainWindow.document.form1.pt_id.value = document.frm.ptid.value;
self.close();
}
</script>
<form name="frm" action="">
(Search results) -- 
<input type="button" value="Select" onClick="post_value();">

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.