• Post Reply Bookmark Topic Watch Topic
  • New Topic

How set Category value to dropdownlist

 
Chandrashekhar Patil
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to set value 'Catogory id' from my subcatogory database.
I have save cid(Catogory id) in subcatogory database. When I want
update a data then i display Category name in Dropdownlist and subcategory
name in input(textbox). But problem is that i have use javascript to
set value in dropdownlist.So user can understand what he had saved previous
data and now he want to update data, means he want reselect another catgory name
from dropdownlist.

e.g. 1-cid 'ABC'-category name. i want just fill up dropdownlist from database
and display a user what he had selected previous and now he can change that
catgory name and reselect new category name.(how search cid id in category
dropdownlist and display category name using javascript)

Could i know why not my javascript is showing that value which i have set in
hidden field. means hidden field of text must match with dropdownlist and use
can see what he had selected previous category name.

Or otherway to set value in dropddownlist..

thanks for appreciate..

 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandrashekhar,

In future, please enclose your code snippets inside code tags. It improves readability of your post. Go through http://www.coderanch.com/how-to/java/UseCodeTags to learn how to use them.

I'll move this to the JSP forum since the solution lies in JSP and javascript, not databases.
 
Roel De Nijs
Sheriff
Posts: 10763
147
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandrashekhar Patil,

Chandrashekhar Patil wrote:Or otherway to set value in dropddownlist..

You should not use Java code in your JSP. Definitely have a read of this article and this one.

Another valuable tip: you don't seem to close your database resources (connection, statement, resultset) once you are done, so you have resource leaks as well in your code.

Hope it helps!
Kind regards,
Roel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!