[Javascript] adding Option to an opener.form.select

Terry bader at tcbader.com
Tue Mar 25 09:54:16 CST 2003


thanks, but using the forms[x] is out of the question as other forms maybe
added in areas previous to the this dynamically...  and your example
addresses a select in the current document and not the opener in which i am
having the problems...

and as for the other info, i know what the function definition is for
option() and how to develop for my audience...  what i need is a second look
at previous code to see if i missed something...  or to see if this is a
know bug/problem...

i tried adding .options[length] to the intialization of the new index but
that still crashed it... even removed the 3rd and 4th arguments in the new
option() declaration... still the same... everything so far leads to a
crashed browser (IE)...

the problem i think is browser based when adding options to select objects
in the opener,  everytime it tries to set something in the opener select for
which an index doesnt not exist it crashes...  however, when just updating a
current index value it works fine, but that means one of my options is
overridden....

so i am now working on a work-around....  was hoping someone had more
constructive data on this problem with a select in the opener...

and as for your "ranting", i would leave that to the other lists to
debate...

thanks....

~ Terry
757 581-5981
AIM/Yahoo: lv2bounce


----- Original Message -----
From: "David T. Lovering" <dlovering at gazos.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Tuesday, March 25, 2003 10:34 AM
Subject: Re: [Javascript] adding Option to an opener.form.select


>
> Ugh!  Cold-Fusion (even the latest and greatest version) is a poor
substitute for good solid PHP, Java, and JavaScript coding.  Its features
are chaotic, non-orthogonal, and integrate very poorly with other packages,
and have all sorts of inheritance
> issues which will drive you mad eventually.  [And let us not forget that
it is God-awful slow, has huge latency problems, and sucks screen and CPU
resources]. The only people who like it are newbies who think they only have
to learn one "language" to make
> everything they want done happen without any downsides.
> Enough ranting.
>
> The method I use for adding to a pre-existing select widget is as
follows --
>
>   var myMenu = document.forms[0].mySelect;
>   myMenu.options[myMenu.length] = new Option("bogus", "bogus-value");
>
> Obviously, you can insert the other two Option parameters if you wish [the
third controls the default selection, and the fourth determines whether this
item is selected for the moment], but I usually leave that to my 'init'
routine to work out.
>
> Although the DOM model certainly encourages you to believe that the
universal constructor assignments are 100% viable, I've had problems with
them, particularly in computing environments with diverse browsers, OS's,
and such like.  You are welcome to try
> them of course (and many are very useful), but be sure to vet them for all
the platforms you expect to have exercising your code.
>
> -- Dave Lovering
>
>
>
>
> Terry wrote:
> code
> -------------------------------------------
> newOption = new Option(optTxt, optVal, 0, 1);
>
opener.#attributes.formName#.#attributes.elem#[opener.#attributes.formName#.
#attributes.elem#.length] = newOption;
>
>
> ok, able to read values from the opener.form.select using the same syntax
as above but i cannot seem to add a new option...
>
> btw, the ## are CF variables, just assume that attributes.formName is the
name of the form from opener and attributes.elem is the name of the select
object......
>
> comments??
>
>
> ~ Terry
> 757 581-5981
> AIM/Yahoo: lv2bounce
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list