Thanks Scott your code worked fine!
I discover why my code wasn't working. I had an extra single quote in my
alert message
which was breaking it. Ahhhh...
I used the following.
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[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.
>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 ){
alert ('You must select at least one question to continue. n\nClick
OK!);
form.mySelect.selectedIndex = 0; // The first index
form.mySelect.focus();
return false;
}
return true;
}
Scott
--------------------------------
Scott Brady
http://www.scottbrady.net/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm