Thanks for your reply, Jörn. I've tried :
rules: { "genre-f": "genreCheck", "genre-m": "genreCheck" } and : rules: { "genre-f": { genreCheck: true }, "genre-m": { genreCheck: true } } with : $.validator.addMethod('genreCheck', function (value) { alert('called'); if( $("#genre-f").is(":checked") || $("#genre-m").is(":checked") ){ return true; }else{ return false; } }, "Please select a genre."); but I don't get any error message and the alert in the genreCheck function shows it's not even called. Any idea why ? On 11 sep, 15:40, Jörn Zaefferer <joern.zaeffe...@googlemail.com> wrote: > Seehttp://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl... > > Jörn > > On Fri, Sep 11, 2009 at 2:26 PM, mattso <matthieu.larc...@gmail.com> wrote: > > > Hi, > > > I'm using the bassistance.de Validation Plugin for jQuery and I have > > the following problem : > > > When using a dash(-) separated id for genres (i.e. genre-f / genre-m), > > I get the following js error : "missing : after property id" with the > > following code: > > rules: { > > genre-f: { > > required: "#genre-m" > > }, > > genre-m: { > > required: function() { > > return $("#genre-f").is(":checked"); > > } > > }, > > It seems that the js (json?) doesn't allow the use of a - inside a > > variable name. > > > Unfortunately, I can't change the id names, as they are being > > generated by Zend Framework which doesn't allow to replace it with > > another character. > > > Anybody would know a way around this ? > > > It seems to me that in the case of multi-options inputs, the script > > should focus on the name instead of the id... > > Any clue would be appreciated.