View Single Post
Old 11-16-2012, 02:02 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,162
Thanks: 59
Thanked 3,992 Times in 3,961 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
First of all, why do you keep repeating document.forms[0] all over the place?

Code:
function confirmsubmit()
{
    var f = document.forms[0];
    if ( f.visitor_name.value == "" || f.visitor_name.value == "Enter your name")
    {
        window.alert("You did not enter your name");
        return false;
    }
    ...
    ... similarly throughout ...
    ...
    // last step:
    for ( var cb = 1; cb <= 5; ++cb )
    {
        if ( f["interest"+cb].checked ) return true;
    }
    alert("You must check at least one interest";
    return false;
}
__________________
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:
CodyJava (11-16-2012)