Re: Setting the focus to form select box item.

2002-12-19 Thread Scott Brady
SelectedIndex is a read-only property in all browsers except Navigator 3 (O'Reilly's JavaScript: The Definitive Guide). Yeah, well that's what I get for writing out the code without testing it . . . . Just change that line to: form.mySelect[0].selected = true; // Select the first index

Re: Setting the focus to form select box item.

2002-12-18 Thread Cutter (CF_Talk)
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

Re: Setting the focus to form select box item.

2002-12-18 Thread Cutter (CF_Talk)
SelectedIndex is a read-only property in all browsers except Navigator 3 (O'Reilly's JavaScript: The Definitive Guide). Cutter Scott Brady wrote: function validateForm(form) { if (form.myText.value.length 1 ){ alert ('You must select at least one question to continue. n\nClick OK!);

RE: Setting the focus to form select box item.

2002-12-18 Thread James Ang
To: CF-Talk Subject: Re: Setting the focus to form select box item. SelectedIndex is a read-only property in all browsers except Navigator 3 (O'Reilly's JavaScript: The Definitive Guide). Cutter Scott Brady wrote: function validateForm(form) { if (form.myText.value.length 1 ){ alert ('You

Setting the focus to form select box item.

2002-12-17 Thread Bosky, Dave
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? -

Re: Setting the focus to form select box item.

2002-12-17 Thread Scott Brady
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; } Try this: function validateForm(form) { if (form.myText.value.length 1 ){

RE: Setting the focus to form select box item.

2002-12-17 Thread Bosky, Dave
to continue. n\nClick OK!); form.mySelect.options[0].focus(); return false; } return true; } Thanks Again. -Original Message- From: Scott Brady [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 17, 2002 4:01 PM To: CF-Talk Subject: Re: Setting the focus to form select box item

RE: Setting the focus to form select box item.

2002-12-17 Thread Scott Brady
form.mySelect.options[0].focus(); I wasn't even aware you could do that. (I didn't know an option could take a focus, so I assumed you had to change the select's selected index to be that element and then focus on the select box). Cool. Scott Brady

Re: Setting the focus to form select box item.

2002-12-17 Thread charlie griefer
Scott Brady writes: form.mySelect.options[0].focus(); I wasn't even aware you could do that. (I didn't know an option could take a focus, so I assumed you had to change the select's selected index to be that element and then focus on the select box). Cool. erri don't think that