rickharrison/validate.js — pull request #80 by MalucoMarinero (2013-07-14 22:25:58+00:00)
Title: Made currently validating field accessible to callbacks.

Adds a 'validating' variable used to make the current field accessible to callbacks. Necessary to implement a 'don't validate if not required clause' in the callback.

That said, maybe it's worth implementing a switch in the rules string, that makes running the callback conditional on an empty field.

For example
['required|callback_foo'] = callback foo will always be called
['!callback_foo'] = callback foo will always be called
['other_rules|callback_foo'] = callback foo will only be called if the field is not empty

Happy to implement if you're happy with this style of implementation.