Hi all -
I am using the jQuery validation plugin on my form. I set the basic rules and messages via javascript like this:
rules:{
"billing.firstname":{
required:true
},
messages:{
"billing.firstname":"First name is required."}
I have the additional requirement to use a javascript function to show a field as invalid with a specified message which I am accomplishing using validator.addMethod then calling validate().element(element) on the field in question.
The problem I am having is that I am unable to override the message set initially with the one provided in the addMethod call. So while my added rule is being used to validate, the original 'First name is required' message always displays even if I clear all rules prior to adding the new one.
Is there a way to force validation of a single rule on a single element or alternatively somehow access the message assigned so I can change it temporarily?
For reference the overall goal is there are some other ajax type functions that happen on the page out of my control and I need to allow them to use a JS function to manually set a field invalid state and message.
Thanks in advance -
b