Select Multiple - Required

Results 1 to 2 of 2

Thread: Select Multiple - Required

  1. #1
    Join Date
    Dec 1969

    Default Select Multiple - Required

    How do I check to see if the user picked a item in a Select multiple?<BR><BR>I want to see if they picked an item and if not tell them to pick one. Preventing the from from being submitted....<BR><BR>thank you...

  2. #2
    Join Date
    Dec 1969

    Default RE: Select Multiple - Required

    Iterate through the .options array and see if any are selected...<BR><BR>function checkSelectedOne(oSelect)<BR>{<BR> for(var i=0; i&#060;oSelect.options.length; i++)<BR> {<BR> if(oSelect.options[i].selected){ return true; }<BR> }<BR> return false;<BR>}<BR><BR>You could probably use the .selectedIndex property... It wouldn&#039;t tell you if they&#039;d selected multiple, I guess, but then do you care?<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts