I'm trying to validate that at least one checkbox of 4 has been
selected.  The code seems simple enough to me.

function testRecipient() {
        var required = ["dir", "dev", "pub", "web"];
        required.each( function (name) {
                if ( $(name).checked == true )
                        return true;
        });

        alert('Please select at least one recpipient for your email.');
        return false;
}

Shouldn't returning true exit directly from the function?  Even if I
reach the return true statement, the function keeps looping until it
reaches the alert and returns false.  I could probably throw $break,
but I feel as if I'm missing something really important here...

Thanks!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to