I haven't yet seen or worked with an example with a large number of
custom methods.

Once added, custom methods behave exactly the same as built-in
methods, therefore I see no reason why that should be a problem.
Lookup is based on JavaScript property lookup, which is hardly a
bottleneck either.

Currently the most obvious bottlenecks in the validation plugin are
DOM manipulations, when adding lots of error messages on submit at
once. So far that didn't cause any actual issues though.

Jörn

On Thu, Jun 26, 2008 at 1:53 PM, Chandler <[EMAIL PROTECTED]> wrote:
>
> Of course! I did have a problem with the email field using the depend
> method. If I left the email field blank (not a valid email address),
> the form would still submit. I had to add "required:true" in order for
> the depend to kick in. Which makes sense.
>
> Well everything seems to work. I'll give a bit of background before I
> carry on though.
> I'm currently creating a visual rules system, which partly includes
> javascript validation. This is built up through a series of rule items
> and each item has it's own validation block. i.e.
>
>        jQuery.validator.addMethod("text1number",
> jQuery.validator.methods.number,"needs a number");
>        $("#text1").rules("add", {
>                required: true,
>                email: {
>                  depends: function(element) { return 
> jQuery("#textarea1").val() ==
> 'buga'}
>                },
>                text1number:true
>        });
>
> We needed custom error messages for each field, which is why I am
> creating a new method each time (if a custom message text exists). Has
> anyone found a problem with this if there are a large quantity of new
> methods added?
>
> Steve
>
> On Jun 26, 12:26 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
> wrote:
>> The depends property works for all methods. Of course param is useful
>> only for methods that actually require a parameter, email and
>> creditcard don't.
>>
>> Overall its still somewhat experimental, as the lack of documentation
>> indicates, so please let me know if there are further issues.
>>
>> Jörn
>>
>>
>>
>> On Thu, Jun 26, 2008 at 11:30 AM, Chandler <[EMAIL PROTECTED]> wrote:
>>
>> > That's brilliant! I do appreciate your help, still mastering jquery.
>> > It worked lovely though I had to append parenthesis to .val.
>> > Is this supposed to work on all of the built in validation functions?
>> > I've tried it on email and creditcard, but it doesn't seem to  apply
>> > quite as well as it does on the maxlength field.
>>
>> > Steve
>>
>> > On Jun 24, 2:58 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
>> > wrote:
>> >> 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- Hide quoted text -
>>
>> >> - Show quoted text -- Hide quoted text -
>>
>> - Show quoted text -
>

Reply via email to