There is just one clientnip, but you can combine the two returns: $("#clientnip").rules("add", { required: function(element) { return $("#type").val() == "P" || $("#type").val() == "S"; }
Jörn On Mon, Feb 9, 2009 at 1:15 PM, Mohd.Tareq <tareq.m...@gmail.com> wrote: > $("#clientnip1").rules("add", { > required: function(element) { > return $("#type").val() == "P"; > } > > $("#clientnip2").rules("add", { > required: function(element) { > return $("#type").val() == "S"; > } > > > one function can return only one value at a time first one i.e. 'p' one > to execute 's' one use above two functions . > hope this will work ;) > > regards > Ragx > > On Mon, Feb 9, 2009 at 1:27 PM, koszu <rafal.kos...@izbarzem.opole.pl> > wrote: >> >> I'm using jquery validate plugin and I have a problem with rules >> depending of form selectors. >> In my form I have got two form selectors: >> >> >> <select name="client.clientType" id="type" class="iefixmargin"><option >> value="">-- Wybierz --</option> >> <option value="B">Bezrobotny</option> >> <option value="N">Nieaktywny >> zawodowo</option> >> <option value="Z">Zatrudniony</option> >> <option value="I">Inny</option> >> <option value="P">Przedsiebiorstwo</option> >> <option >> value="S">Samozatrudnony</option></select> >> >> and >> >> <input name="clientnip" id="clientnip" maxlength="14" value="" >> class="tekst" type="text"> >> >> I'd like to make "clientnip" required if "type" value is "P" or "S". >> I tried this: >> >> $("#clientnip").rules("add", { >> required: function(element) { >> return $("#type").val() == "P"; >> return $("#type").val() == "S"; >> } >> >> It works for type value = "P" and ignore "S". >> >> Could some one help me? >> > > >