Multiselect List Boxes Validation Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syam
    New Member
    • Dec 2006
    • 28

    Multiselect List Boxes Validation Problem

    Hai Friends..

    I have a search page and contains multiple multiselect list boxes, each containing 6 options. I want to check whether the user has checked atleast one option in each of those list boxes at the time the user clicking the Search button. How do i validate this .

    Thanks in advance...
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    you have to loop through you 'multiple-selects' and check every one of them for

    Code:
    list_ref.selectedIndex != -1
    the selectedIndex gives you the index of the first selected option in a list ... when nothing is selected the value of selectedIndex is -1.

    kind regards

    Comment

    Working...