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 how do I validate a listbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how do I validate a listbox" Watch "how do I validate a listbox" New topic
Author

how do I validate a listbox

ushank
Greenhorn

Joined: Aug 04, 2003
Posts: 6
I want to validate a listbox by writing a small javascript which will not allow duplicate values inside it,and should pop an alert box when tried to duplicate, could anyone tell me how to go about with a sample javascript code.
Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Duplicate values? give me an example if you can.
ushank
Greenhorn

Joined: Aug 04, 2003
Posts: 6
I enter a store number into the list box like 1001,1002 1003 and later I try to renter 1001 through a text box then I should be able to stop it with a alert box.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Sounds like a fairly straight-forward matter of programming to me.
Have you tried to write any code yet? What has you stumped?
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ushank
Greenhorn

Joined: Aug 04, 2003
Posts: 6
well I'm new to scripting never tried so I need some sample kick off where I can grap and pick up my skills.
Sorry
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You would have to compare the values of the select with the values of the text box.
How are the values of the select populated? Hard Coded, from an array, from a database?
Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how do I validate a listbox
 
Similar Threads
Populate listbox from sql
Comparing listbox option with a variable value
E-mail address validation
Validating email in javascript?
how do I validate a list box