Via the param property: maxlength: { param: 5, depends: function(element) { return jQuery("#textarea1").val == 'buga' && jQuery("#textarea2").val != 'booga' } }
Jörn On Tue, Jun 24, 2008 at 1:52 PM, Chandler <[EMAIL PROTECTED]> wrote: > > Hi Jörn, > > It sounds good, but how would I pass maxLength a value? i.e. max chars > of 5? > > Steve > > On Jun 20, 8:32 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]> > wrote: >> Give this a try: >> >> maxlength: { >> depends: function(element) { return jQuery("#textarea1").val == >> 'buga' && jQuery("#textarea2").val != 'booga' } >> >> } >> >> Jörn >> >> On Fri, Jun 20, 2008 at 7:20 PM,Chandler<[EMAIL PROTECTED]> wrote: >> >> > Hi all, >> >> > I'm just getting to grips with this Validation plug-in but would like >> > to check whether something is possible. >> > I would like to run validation on a field based on values from other >> > parts of the form. >> >> > I realise that this is possible with the required field, i.e. >> >> > required: function(element) { return jQuery("#textarea1").val == >> > 'buga' && jQuery("#textarea2").val != 'booga' } >> >> > But this is also possible for the other functions? i.e. the same as >> > above but for maxLength? >> >> > maxLength: function(element) { return jQuery("#textarea1").val == >> > 'buga' && jQuery("#textarea2").val != 'booga' } >> >> > The reason I ask is that I would like to apply validation but not >> > necessarily have the form field as mandatory. >> >> > Many thanks, >> >> > Steve >