JSP form problem

R

ruds

hi,
I have a JSp form, when a user selects an option from a pull down
menu, I want to update the next select options based on the previously
selected option.
For E.G:
My first select options are: Color/Fruits
If user selects Color, then the next dropdown options would be:
RED,YELLOW,GREEN,BLUE
If user selects Fruits then the drop down should have:
APPLE,ORANGE,BANANA...

How should I do this?
I konw i need to use JavaScript but how?
 
A

Arne Vajhøj

ruds said:
I have a JSp form, when a user selects an option from a pull down
menu, I want to update the next select options based on the previously
selected option.
For E.G:
My first select options are: Color/Fruits
If user selects Color, then the next dropdown options would be:
RED,YELLOW,GREEN,BLUE
If user selects Fruits then the drop down should have:
APPLE,ORANGE,BANANA...

How should I do this?
I konw i need to use JavaScript but how?

You need either to submit the form after the
first selection or use AJAX to update the second
after the first selection.

If you use JSF there are plenty of AJAX taglibs.

For pure JSP there are a few.

http://ajaxtags.sourceforge.net/

can do what you want and is reasonable simple.

Arne
 
A

Arne Vajhøj

Sabine said:
Ask this question again in comp.lang.javascript then ;)

If he want to go into the world of having to maintain
lots of poorly unstructured JavaScript code.

Using a taglib that outputs the JavaScript makes maintenance
a lot easier.

Arne
 

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
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top