Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

auto suggest in dropdown list using struts/jsp

 
Sri haran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Need to have a drop down list with populated values; but when the user wants to select a value, he can either type in the first few letters or select it from the drop down list with the mouse or both.

example: a drop down list has 10 values. the user
clicks on the drop down and it allows him to type in the box or select the value from the drop down, but if he type "A" it will just to all the values starting with "A" and if he continues to type "Al" it will further goto all
the values that start with "Al" e.g. "Alex" and "Albert".

How do i go about doing this using Struts/JSP/Javascript?

Any sample code/example would be great.

Thanks in advance.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Browsers already support that, unless you actually want an Ajaxified version that pulls data from the server side while typing.
 
Sri haran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
Thanks for the update.
Actually , i'm using Struts 1.1 / Javascript / JSP and the values for the dropdown list are coming from the DB.
So, i need an example for this (not the browser supporting feature).

thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd just look on the net--the back-end technology isn't really relevant.

I'd *strongly* recommend using a JavaScript library on the client side, though--there's zero reason to do all the Ajax/DOM work manually these days.
 
Sri haran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
Thanks. yes, you are right, I have to use javascript . Do u've any sample code / link for this?; So, that i can customize to our requirement.

Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search the web--there are a million ways to do this, and thousands of examples.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic