View Single Post
Old 03-13-2013, 10:07 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
It's the type="submit", but only indirectly.

The real problem is your Validate() function.

You *DO* correctly code return Validate() in the <form> tag, but then you never do a return false from that function!

When you don't return any particular value from Validate(), you have ONLY a 1 in 4 billion chance that the form will *not* submit, or in other words near certainty that it will.

So you need:
Code:
function Validate() {
    
    var value = readCookie('TestCookie');

    if ( value == 1 && document.validate.drugid.selectedIndex == 5 )
    {
		redirect();   
                return false; 
   }
   ... and then maybe you need return false here as well...
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
Max31 (03-13-2013)