Closed Thread Icon

Preserved Topic: JavaScript Window Problem Pages that link to <a href="https://ozoneasylum.com/backlink?for=18216" title="Pages that link to Preserved Topic: JavaScript Window Problem" rel="nofollow" >Preserved Topic: JavaScript Window Problem\

 
Author Thread
Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

posted posted 07-23-2001 23:26

For simplification sake, I will refer to two windows: window_A and window_B.

Window_A when loaded generates window_B. Window_B is a form and the target for this form is window_A.
What I would like to do, is give Window_A the focus when it has received this post data. I am stuck and do not know how to accomplish this, it seems as if it is not possible, since Window_B was generated by Window_A to begin with, and the fact that Window_A "wants" to regenerate Window_B each time.
Anyhow, have I explained this well enough?

Thanks a bunch! (no one stress or anything, but I'm suppost to have the problem solved by end of day!) : )

Karl

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-23-2001 23:52

Here's the thing if you want window_A to handle the form from window_B you must pass the form data to window_A

This gets a bit complicated, but it can be done.

The easiest way to do this is to create a "hidden" form in the A window. All the fields are identical to the ones on the form in window B

Window A form example
<form action="whatever.cgi" method="post" name="formA">
<input type="hidden" name="field1" value="nada">
<input type="hidden" name="field2" value="nada">
<input type="hidden" name="field3" value="nada">
</form>

Window B form you already have.

Then you want to run a script that runs on submit from form B that looks something like this. This script goes in the head of window B.

function handleForm(daForm) {
window.opener.formA.field1.value = daform.field1.value;
window.opener.formA.field2.value = daform.field2.value;
window.opener.formA.field3.value = daform.field3.value;

window.opener.formA.submit();
window.opener.focus()
return false
}


Then in your form field

<form name="formA" onSubmit(return(handleForm(this)))>


This is all untested but put it together and show us a link and we can be more helpful.





:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

posted posted 07-24-2001 00:16

I'm sorry, I don't get it : (
I don't know how to put this code together as you have suggested.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-24-2001 00:33

Post the HTML for the form





:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

posted posted 07-24-2001 01:10

<form name="form1" method="post" action="default.asp" target="main">
<table width=825 border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<table width="825" border="0" cellspacing="3" cellpadding="3">
<tr bgcolor="#FFFFCC">
<td align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><b>Product Numbers:</b><br>
<input type="Text" name="fPrd" value="" id=1>
&nbsp;<br>
<input type="submit" name="Submit" value="AddProd">
</td>
</tr>
<tr>
<td>
<p><b>Codes:</b><br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="0" checked id=1>
Domestic<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="1" id=2>
Distributors<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="2" id=3>
Export (Non-Europe)<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="3" id=4>
Other<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="4" id=5>
Dealers<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="5" id=6>
End Sales<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod" value="6" id=7>
Sales to Europe<br>
&nbsp;</p>
</td>
</tr>
</table>
</td>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="25%"><b>Months </b></td>
<td>
<select name="mon" id=1>
<option value="3">3</option>
<option value="6">6</option>
<option value="12">12</option>
<option selected value="18">18</option>
<option value="24">24</option>
<option value="30">30</option>
<option value="36">36</option>
<option value="42">42</option>
<option value="48">48</option>
<option value="54">54</option>
<option value="60">60</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="25%"><b>By: </b></td>
<td>
<input type="radio" name="type" value="0" checked >
Unit Sales<br>
<input type="radio" name="type" value="1">
Sale Doll$$<br>
<input type="radio" name="type" value="2">
Sales Margin<br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="25%"><i><b>$ scale</b></i></td>
<td>
<select name="kvalue" id=2>
<option selected value="1"> - </option>
<option value="10">x 10</option>
<option value="100">x 100</option>
<option value="1000">x 1000</option>
<option value="10000">x 10000</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<div align="left"><b>Smoothing</b>
<input type="CheckBox" name="smoothline" value="smooth" id=8>
<select name="smoothfactor" id=3>
<option value="1">1</option>
<option value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="14">14</option>
<option value="16">16</option>
<option value="24">24</option>
<option value="32">32</option>
<option value="64">64</option>
<option value="96">96</option>
<option value="128">128</option>
<option value="160">160</option>
<option value="192">192</option>
<option value="224">224</option>
<option value="256">256</option>
</select>
<br>
<input type="radio" name="SmoothType" value="LINE" checked >
Show as Line<br>
<input type="radio" name="SmoothType" value="GRAPH">
Apply to Graph<b> </b></div>
</td>
</tr>
<tr>
<td>&nbsp; </td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Submit">
<input type="submit" name="Submit" value="Reset">
</td>
</tr>
</table>
</td>
<td valign="top" bordercolor="#CCCCCC">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>
<input type="CheckBox" name="budgetcomparison" value="compare" id=16>
<b>Percentile Contribution</b></td>
</tr>
<tr>
<td><b>Product Numbers:</b><br>
<input type="Text" name="fPrd2" value="" id=2>
&nbsp; <br>
<input type="submit" name="Submit" value="AddComp")">
</td>
</tr>
<tr>
<td> <b>Codes:</b><br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="0" checked id=9>
Domestic<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="1" id=10>
Domestic Distributors<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="2" id=11>
Export (Non-Europe)<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="3" id=12>
Other<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="4" id=13>
Canadian Dealers<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="5" id=14>
European End Sales<br>
&nbsp;&nbsp;&nbsp;
<input type="CheckBox" name="fCod2" value="6" id=15>
Sales to Europe<br>
&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>


« BackwardsOnwards »

Show Forum Drop Down Menu