On 9/6/07, Joel Birch <[EMAIL PROTECTED]> wrote:

> function validate_form(){
>         var valid = true;
>         //loop through the radio sets
>         $('tr.radioSet').each(function(){
>                 var theRadioSet = this;
>                 //make sure at least one radio is checked
>                 //do not use @ symbol if using jQuery 1.1.4, it's deprecated
>                 if ( $('input[type=radio]:checked',theRadioSet).length != -1 
> ){
>                         valid = false;
>                         alert ('The question with id "'+theRadioSet.id+'" was 
> not answered');
>                         return false; //I *think* this halts further 'each' 
> cycles
>                 }
>         });
>         return valid;
> }

Sorry, already found an error. This line:

if ( $('input[type=radio]:checked',theRadioSet).length != -1 ){

Should be:

if ( $('input[type=radio]:checked',theRadioSet).length == -1 ){

...it's very late...

Joel.

Reply via email to