Does an example exist?

P

PythonistL

Hello,
I would like to improve my web project with javascript for this task:

I have a form where users must choose a main category( presented by a
drop-down menu) and according to this main category selection, another
drop-down menu is shown with a list of subcategories suitable for this
main category (that a user had chosen).

Is there an example of this available where I could learn how to do
that in javascript?
Thank you for help.

L.
 
M

Maqish

i do think there are several examples available but would you like to
see a new dropdown to appear as soon as you change the selection in the
dropdown?

i would add an onchange event on the dropdown where the onchange will
set the visibility of a value related dropdown. this is the most
easiest way.
 
R

RobG

PythonistL said:
Hello,
I would like to improve my web project with javascript for this task:

I have a form where users must choose a main category( presented by a
drop-down menu) and according to this main category selection, another
drop-down menu is shown with a list of subcategories suitable for this
main category (that a user had chosen).

Is there an example of this available where I could learn how to do
that in javascript?

Try this:

<URL: http://www.javascripttoolbox.com/lib/dynamicoptionlist/ >
 
P

PythonistL

Maqish said:
i do think there are several examples available but would you like to
see a new dropdown to appear as soon as you change the selection in the
dropdown?

i would add an onchange event on the dropdown where the onchange will
set the visibility of a value related dropdown. this is the most
easiest way.
Maqish,
Can you please send me URL where I can see the examples. I am a newbie
with Javascript.
I am not sure how I can pair a main category with all appropriate
subcategories
Thank you
L.
 
M

Maqish

take a look at the example RobG handed you..

if that is not what you would like to do i will give you an example
 
P

PythonistL

Maqish said:
take a look at the example RobG handed you..

if that is not what you would like to do i will give you an example
Maqish,
Thank you for your reply and thank you RobG for the link
http://www.javascripttoolbox.com/lib/dynamicoptionlist/

It looks almost what I need but there is one problem.

For example if a user select
girl and a name Jane, the script returns Jane.
Is it so?

But for further processing, in my program, I would need to link a name,
with a number.
For example:
if a user select Jane I would need a return value e.g. 00101,
similarly,
if a user select Angie, from that example( at
http://www.javascripttoolbox.com/lib/dynamicoptionlist/ )
the user will see Angie, in the dropdown menu, but the program will
receive e.g. 00201 or what ever different value from that being seen
in the dropdown menu

Is it possible?
Thank you for the reply
L.
 
M

Maqish

The value of an item can be different from the display value it has.

<select name="cars">
<option value ="01">Volvo</option>
<option value ="02">Saab</option>
<option value ="03" selected="selected">Opel</option>
<option value ="04">Audi</option>
</select>

you can read the selected value from the cars element and use that to
fill the other element
here is a nice example that shows howto do that..

http://lists.evolt.org/archive/Week-of-Mon-20000807/015298.html
 

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

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top