jzaefferer/jquery-validation — pull request #867 by johnnyreilly (2013-08-23 16:18:36+00:00)
Title: Added the ability to pass additional fields to remote validation using the data attribute support ( addresses #836 )

This pull request provides a mechanism to allow the sending of other inputs as data when performing remote validation. This is achieved by allowing users to specify a `dataSelector`. If supplied the data selector will take the element being validated as a starting point and find the closest match walking up the DOM of that selector. All the inputs contained within the target will then be included in the data passed in the request.

If you wanted the entire form contents to be passed then a `dataSelector` of `"form"` would work.

If validating an element that appeared in a table and you wanted just elements appearing in your current table row then a `dataSelector` of `"tr"` would work. This approach is particularly useful to me when I have grids where each row represents an entity and I need to perform entity specific remote validation. This also fits well with the existing unobtrusive (data attribute driven validation) support which is a particular advantage when you have elements being added dynamically to the DOM.

If a `dataSelector` has not been supplied then existing remote validation behaviour will be completely unaffected.

This pull request is supplied with unit tests which demonstrate both the use cases described above.