tags:

views:

203

answers:

1

Is it possible to override the default minlength error message in the callback invalidHandler ?

Say by default the error message for minlength would be Please enter at least {0} characters. Can this be overriden with the inclusion of the form element say {element} - Please enter at least {0} characters. validator.numberOfInvalids() is able to capture this error but am not able to figure out how to override the error message of the corresponding error.

Any help in this context is really appreciated, Thanks.

A: 

See this page for the document ion. I think what you want is to set a message option.

$(".selector").validate({
     rules: {
          name: "required"
     },
     messages: {
          name: {
             required: $(this).id + "error message"
          }
     }
})

Can't test this right now, but this is what I would try.

idrumgood
Thanks for your response. Yes I shouldn't be trying to do this in invalidHandler. Anyways will accept your response as answer. Thanks again.
tyro