File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Comparing listbox option with a variable value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Comparing listbox option with a variable value" Watch "Comparing listbox option with a variable value" New topic
Author

Comparing listbox option with a variable value

Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
How can I compare an option of Listbox with a variable and make it get selected.
Pavan Keely
Ranch Hand

Joined: Jun 30, 2006
Posts: 62
Sree,

Here is a piece of code...



Basically, you have to loop through all the values of the options and see if that matches with the required value. If yes, select that option.

Hope this helps.


Pavan Keely<br /><a href="http://keelypavan.blogspot.com" target="_blank" rel="nofollow">http://keelypavan.blogspot.com</a>
Sree Mami
Ranch Hand

Joined: Jul 13, 2006
Posts: 75
Hi Pavan

Thanks for the reply. It surely works for my task. Actually I tried it but somewhere I went wrong. May be in referencing within the loop...

Thanks a lot...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Comparing listbox option with a variable value