Got that option-list code...how do I use it?

C

Charles Packer

For the dynamically-fed two-listbox problem I queried
about earlier, a followup by VK pointed me to a
solid-looking script at
http://www.javascripttoolbox.com/lib/dynamicoptionlist
The documentation tells how to use it...up to a point.
One of its examples is the following:

<script type="text/javascript">
var names = new DynamicOptionList();
names.addDependentFields("sex","names");
names.forValue("boy").addOptions("Matt","Bob","Joe","Bill","John");
names.forValue("girl").addOptions("Jane","Angie","Jennifer","Amy","Sue");
names.forValue("boy").setDefaultOptions("Joe");
</script>

I assume that I'm supposed to put this in the body of my
test script. I also understand that I invoke it with a
"select" thingy...

<form>
<select [...?...] >
</select>
</form>

I think there's supposed to be something between the
brackets, above, but no clue is given. And, after
working through the Javascript tutorial at
http://www.w3schools.com/js/default.asp
I still haven't learned enough to figure out what it is...
Help would be appreciated.
 
G

Gregor Kofler

Charles Packer meinte:
For the dynamically-fed two-listbox problem I queried
about earlier, a followup by VK pointed me to a
solid-looking script at
http://www.javascripttoolbox.com/lib/dynamicoptionlist
The documentation tells how to use it...up to a point.
One of its examples is the following:

<script type="text/javascript">
var names = new DynamicOptionList();
names.addDependentFields("sex","names");
names.forValue("boy").addOptions("Matt","Bob","Joe","Bill","John");
names.forValue("girl").addOptions("Jane","Angie","Jennifer","Amy","Sue");
names.forValue("boy").setDefaultOptions("Joe");
</script>

I assume that I'm supposed to put this in the body of my
test script. I also understand that I invoke it with a
"select" thingy...

<form>
<select [...?...] >
</select>
</form>

I think there's supposed to be something between the
brackets, above, but no clue is given.

Well, you could look into the source of the page. This would reveal that
the select elements have name attributes with the values "sex" and
"names"...

Gregor
 
C

Charles Packer

Well, you could look into the source of the page. This would reveal that

Ja...this didn't occur to me, somehow. And what I had pasted from
within the dotted lines wasn't even the "real" code.
Now I get only the parent (Boy, Girl) listbox, with the
child empty...but that's progress, at least....sigh...
Web design is _such_ a !@#$%^&* hall of mirrors...
 
C

Charles Packer

Ja...this didn't occur to me, somehow. And what I had pasted from
within the dotted lines wasn't even the "real" code.
Now I get only the parent (Boy, Girl) listbox, with the
child empty...but that's progress, at least....sigh...
Web design is _such_ a !@#$%^&* hall of mirrors...

....And this turns out to be a path problem in referencing
the script as an external file. Web design is a hall of
mirrors -- in a sewer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top