The "options[]" element of the select is an array. Arrays in javascript 
begin with 0.

Cutter

Bosky, Dave wrote:

>I'm using the onsubmit function to check the length of a form textfield to
>verify it contains at least one character.
>If the value is less than one character I want to return false and set the
>focus to the first item in a select box.
>What am I leaving out?
>
>-------------------------------------
>function validateForm(form) { 
>if (form.myText.value.length < 1 ){
>    alert ('You must select at least one question to continue. n\nClick
>OK!);
>    form.mySelect.options[1].focus();
>    return false;
>}
>return true;
>}
>-----------------------------------------
><FORM action="update.cfm" method="post" onSubmit="return
>validateForm(this);">
><INPUT TYPE="TEXT" NAME="myText" VALUE="">
><SELECT NAME='mySelect" SIZE="20" MULTIPLE>
>       <OPTION VALUE="1">1</OPTION>
>       <OPTION VALUE="2">2</OPTION>
>       <OPTION VALUE="3">3</OPTION>
></SELECT>
><INPUT TYPE="SUBMIT" VALUE="GO">
></FORM>
>-----------------------------------------
>
>thx
>Dave
>
>
>HTC Disclaimer:  The information contained in this message may be privileged and 
>confidential and protected from disclosure. If the reader of this message is not the 
>intended recipient, or an employee or agent responsible for delivering this message 
>to the intended recipient, you are hereby notified that any dissemination, 
>distribution or copying of this communication is strictly prohibited.  If you have 
>received this communication in error, please notify us immediately by replying to the 
>message and deleting it from your computer.  Thank you.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to