Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Reading value from combobox

Reading value from combobox

Reading value from combobox


I have a combobox and i successfully retrieve some value in it from database.

Now i have a menu designed using javascript. So when i click on this menu, i want to retrieve the selected value in that combo box and pass it to another jsp page.
How can i do that

my combo box name is 'dtr'

Need to get it here somehow


<LI><A href="Getdata2.jsp?TFCode1=<%= comboboxvalue %>">View Details </A>
Please help me as this is urgent1


RE: Reading value from combobox

Once the page is drawn, all your embedded Java code is converted to HTML/JavaScript.  If you need the current value of the combobox, I would recommend:


<LI><A href="javascript:void(0)" onclick='getdata2(this.form)'>View Details </A>
..and then writing a javascript function to define the address you want to go to as such:


function getdata2(formObj)
 var val = formObj.myComboBox.value;
 document.location = "Getdata2.jsp?TFCode1="+val;

In the event that an anchor tag does not recognize "this.form", you can replace with "document.forms[0]".

Either way, this requires your users to have JavaScript enabled.

If you can't count on JavaScript being enabled, then you might consider changing the link to a Submit button with the action of your form being set to "Getdata2.jsp".  This will send form values to the target JSP (including your combobox value).

...or am I misunderstanding your question?


...east is east and west is west and if you take cranberries and stew them like applesauce
they taste much more like prunes than rhubarb does

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close