hi
another little issue in my long form:)

i got 5 couples of radio button:

<input name="name1" type="radio" value="si" class="className" />
<input name="name1" type="radio" value="no" class="className" />

<input name="name2" type="radio" value="si" class="className" />
<input name="name2" type="radio" value="no" class="className" />

<input name="name3" type="radio" value="si" class="className" />
<input name="name3" type="radio" value="no" class="className" />

<input name="name4" type="radio" value="si" class="className" />
<input name="name4" type="radio" value="no" class="className" />

<input name="name5" type="radio" value="si" class="className" />
<input name="name5" type="radio" value="no" class="className" />

The validation rule against them must be:
- at least one radiobutton with value 'si' must be checked.

I added a classRule  but apparently this doesn't work for
radiobuttons.
$.validator.addClassRules({
  className: { required: function(element){
                                                        var id ;
                                                        var chk;
                                                        var val;
                                                        
$(element).each(function(){
                                                                id = 
$(this).attr('id');
                                                                chk = 
$(this).attr('checked');
                                                                val = 
$(this).val();
                                                                alert (id + ' ' 
+ chk + ' ' + val)
                                                                if ((val == 
'si') && (chk == true)){
                                                                        return 
true;
                                                                }
                                                        });

                                                }
                }

I put the alert to show that the plugin in its cycle takes into
consderation only the radiobutton with value 'si' (twice) and no the
seconds one with value no!

Is this possible or is just a mistake of mine?
Thanks Vitto


Reply via email to