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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form in Child Win won't submit to parent in NN

Status
Not open for further replies.

ChrisQuick

Programmer
Oct 4, 1999
144
US
I have a function set as the OnClick event for a button.

The code for the function is:
Code:
<script type=&quot;text/javascript&quot; language=&quot;JavaScript 1.2&quot;>
  function showNewLegendWindow() {
    ccMapLegend=window.open('','msg','toolbar=yes,location=yes,menubar=yes,height=300,width=200,resizable=yes,scrollbars=yes,left=0,top=0')
    ccMapLegend.document.write(&quot;<html><head><title>Legend</title>&quot;)
    ccMapLegend.document.write(&quot;</head><body>&quot;)
    ccMapLegend.document.write(&quot;<form OnSubmit=\&quot;self.close()\&quot;>&quot;)
    ccMapLegend.document.write(&quot;<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 COLS=1><tr><td align='center'>&quot;)
    ccMapLegend.document.write(&quot;<INPUT TYPE=submit STYLE=\&quot;{background-color: blue; color: white}\&quot; VALUE='Refresh Layers' OnClick=\&quot;this.form.target=opener.name\&quot;></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<input type=hidden name=name value='columbia'>&quot;)

ccMapLegend.document.write(&quot;<input type=hidden name=cmd value='refresh'>&quot;)
    
ccMapLegend.document.write(&quot; <INPUT TYPE='hidden' NAME='Left' Value=572139.071912><INPUT TYPE='hidden' NAME='Bottom' Value=1220284.87947><INPUT TYPE='hidden' NAME='Right' Value=698089.798366><INPUT TYPE='hidden' NAME='Top' Value=1346088.755075>  &quot;)

ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Tax_Parcels' Checked><Font face='arial' size='1'>Tax Parcels</font></input></td></tr>&quot;)
    
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Buildings'><Font face='arial' size='1'>Buildings</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='FEMA_Firm'><Font face='arial' size='1'>FEMA Firm</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Police_Beats'><Font face='arial' size='1'>Police Beats</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Wetlands'><Font face='arial' size='1'>Wetlands</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Lakes'><Font face='arial' size='1'>Lakes</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Streams'><Font face='arial' size='1'>Streams</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Zoning'><Font face='arial' size='1'>Zoning</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Fire_Districts'><Font face='arial' size='1'>Fire Districts</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Drainage_Basins'><Font face='arial' size='1'>Drainage Basins</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='Primary_Roads' Checked><Font face='arial' size='1'>Primary Roads</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='City_Limits' Checked><Font face='arial' size='1'>City Limits</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;<tr><td align='left'><INPUT TYPE=CHECKBOX NAME='County_Boundary' Checked><Font face='arial' size='1'>County Boundary</font></input></td></tr>&quot;)
    ccMapLegend.document.write(&quot;</table></form></body></html>&quot;)
}
</script>

A new window will open and display the form. The user can then check or uncheck boxes and then press the &quot;Refresh Layers&quot; button to submit the form back to the parent.


This works fine in IE, but in NetScape, the window simply closes. Can anyone tell me what I am doing wrong?

chrisquick@aol.com
Geographic Information System (GIS), ASP, some Oracle
 
To my understanding, the onsubmit event is called before the form actually submits (maybe it should be called onbeforesubmit).

For a solution, in the onclick event of the button (change to input type=button) you could try adding the values you need to a querystring and try:

opener.location=opener.location+&quot;?&quot;+myquerystringvals

or something like that...sorry I'm not much of a Netscrape guy jared@aauser.com
 
When you say &quot;submit back to the parent&quot;, what exactly are you trying to accomplish? I don't think you can submit a form to an opened HTML page. Perhaps what you should do is take the values of the checkboxes, put them into an array, and then pass that to a function in the parent window.

onsubmit=&quot;{
array = (forms[1].tax_parcels,forms[1].buildings...);
opener.function(array);
window.close();
}&quot;
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top