I'm creating a popup that will allow me to select values from it, then after I've selected the values, I need to close the window, then pass it to my main form.
The code in my main form:
onClick="cust=window.open('popup.php?count=<?=$RowStart?>&name_id=' + document.form1.name_id<?=$RowStart?>.value'custWindow','top=50, left=50, height=150, width=375, scrollbars=yes, resizable=yes');cust.focus(););
And the code inside the popup:
<form name="form1" action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<input id="name" name="name" type="text"/>
<input id="nameid" name="nameid" type="hidden" value ="<?=$name_id?>"/>
</td>
<td>
<input name="ellipse" type="button" value="..." onClick="ellipse=window.open('engine_item_list2.php?name='+document.form1.name.value,'ellipse','top=50,left=50,width=500,height=500, scrollbars=yes, resizable=yes'); ellipse.focus();"/>
</td>
</tr>
</table>
</form>
What happens is when I click the button in the main form, it goes to open a new window where the popup has a form. Inside the form is an ellipse that gets the value for the name_id using the input from the name textfield.
I am able to get the values from the ellipse to the name_id, because the ellipse has a submit button inside it. But my popup window form1 should not have a save button involved, so I have to pass the values from the popup window back to the main form by either submitting it when I close the popup or using another way.
I think I should use a window.close() but I dont know how to pass the data back using it. Is there a way I can link the close button in the window such that when it gets clicked the values gets to be passed back to the main form?