Ahhhh, good point. Hows about this...

function submitForm() {

        var firstValue =
document.form1.prodsize[document.form1.prodsize.selectedIndex].value;
        var secondValue =
document.form1.prodcolor[document.form1.prodcolor.selectedIndex].value;

        if ( firstValue == "" && secondValue != "" )
                alert("Please select a size");
        else if ( firstValue != "" && secondValue != "" )
                document.form1.submit();

}

Call submitForm() in both select's onchange().

Ade

-----Original Message-----
From: Will Tomlinson [mailto:[EMAIL PROTECTED]
Sent: 14 January 2005 01:27
To: CF-Talk
Subject: Re: Javascript two selects....how to force the first select
FIRST


Adrian,

This is REAL close, I appreciate the help. It works and improves what I
have, but could be better. Here's what happens.

Some goofball selects the second select first, ALERT - "please select a
size".

Now you select the size - it doesn't submit because of course, there's no
onchange on that one.

So now you have to select the color again and change it to SUBMIT the form.
Here's what I have so far. Thanks!  Will

<InvalidTag language="JavaScript">
<!--
function submitForm()

{
  if ( document.form1.prodsize[document.form1.prodsize.selectedIndex].value
!= 0 )
    document.form1.submit();
  else
    alert("Please select a size");
        }
//-->
</script>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Now there’s a better way to fax. eFax makes it possible to use your existing 
email account to send and receive faxes. Try eFax free.
http://www.houseoffusion.com/banners/view.cfm?bannerid=63

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190375
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to