Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prefilling multi-select list

Status
Not open for further replies.

newb123

Programmer
Apr 27, 2007
1
US
Hi All,
I am trying to write some Javascript but am completely lost. I have a multi-select list on my JSP page which is populated by a list of values from a database table. The user then select multiple values from the list and submits the form. These selected values are stored in the DB in another table as a string separated by a delimiter. When the user comes back to the page, the list should now highlight the values that were earlier selected by the user (as if reading from the DB and displaying). Can I do this using Javascript ? Please help.

Thanks.
 
I don't understand why you'd want to do this in JavaScript when you clearly have server-side technology available to you. Doing this server-side when delivering the page would be better, as it would also work for those with JS disabled.

You would output the options to the page with a "selected" attribute if the relevant option needed to be selected.

If you still want to do this in client-side JS, then I can certainly show you some cod to do so... but this sort of thing really is better off being delivered to the page correctly to start with.

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top