[Javascript] dynamic forms - HELP

Seth Northrop seth at calculon.northrops.com
Wed Mar 28 13:40:02 CST 2001


I'm getting desperate!  :)

The only thing I was to happen is to pop up a window with a form, and,
have that form result in a population of a select menu.  The text box will
result in what's seen by the user.  The value of that element will be
dynamically generated by a backend script and built into the
javascript.  The only snag to this equation is that some variable names
have [ ]'s in their names (which is a reserved character in javascript.

This is what I have:

<html>
<head>
<Script Language = "Javascript" Type="Text/Javascript">

<!--  Hide script from older browsers
 pWin = window.opener;
 pOpt = pWin.document.formName.elements["step_spec_nameID"].options;
 pOpt[pOpt.length] = new Option('This is a test', 5652023, true, true);
 window.close();
// -->

</script>
</head>

In Netscape it works with ONE exception.  Although the value APPEARS to be
selected once it's dynamically added, if the user doesn't actually TOUCH
the pull down (ie, REselect the value) it will submit the form with the
value of the element that was selected BEFORE the new value was added.  
So, I need to either FORCE it to select the new value (and submit with
that value without intervention) OR NOT have it selected so the user will
think to select it manually.

In IE it doesn't work AT ALL!  It just dumps the above code and doesn't
update the pull down OR execute the window.close();  I presume there is a
javascript parse error in there.. but, IE doesn't seem to indicate that.

Ugh!  This one little javascript UI issue is holding back a rather huge
project (nearly 50k of backend programming).  

Can anyone help?





More information about the Javascript mailing list