In order to do this you would need to modify the jquery-validate.js
file.
The code associated with remote validation:
remote: function(value, element, param) {
if ( this.optional(element) )
return "dependency-mismatch";
var previous = this.previousValue(element);
....
// ajax call
....
}
The first if
block tests if the element is optional, which it will be unless a [Required]
attribute has been applied to the property, or the property is a value type (I assume you property is typeof string
) so the function returns and the code to make the ajax call is never reached. Note that even if you added the [Required]
attribute, this code block would never called because required:
is validated first and you would just get the "The XXX filed is required" message.
If you comment out the first if
block, and focus out with an empty string, the remote validation will be fired.