Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1550 How to determine whether the user has already selected an option from a multi select list?

irt.org | Knowledge Base | JavaScript | Form | Q1550 [ previous next ]

Q1550 How to determine whether the user has already selected an option from a multi select list?

Either make the first item a dummy one "Please select" and use:

<script language="JavaScript"><!--
if (document.myForm.mySelect.selectedIndex < 0) someThingSelected=true
//--></script>

Or you need to loop through all the entries:

<script language="JavaScript"><!--
if (document.myForm.mySelect.selectedIndex < 0) {
   morethanone = false;
   for (i=document.myForm.mySelect.selectedIndex;i

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.