[Validate] How do I remap the return key?
So, a bit of an oddball situation...I'm using the jQuery Validate plugin to validate a form and want to remap the return key. But the form is a bit weird - there are two groups of fields that each have their own submit button, but the whole thing is wrapped within one form element (I know it should really be two, but for certain reasons I can't do that).
If you click either one of the submit buttons, it works fine (each submit button uses the rules() method to add the rules/messages for its particular group of fields, and removes the rules/messages for the other group, so that the form can still be submitted even though only part of it is filled out).
The problem is that when you hit the return key to submit the form, it always "clicks" the first submit button (I guess because the browser just defaults to the first one within the form). But I want the return key to click the second submit button if any of the fields in the second group are focused.
Any ideas how to do this? I was able to remap the return key so that hitting it will "click" the appropriate submit button, but when I do so, the validation doesn't fire and the form gets submitted immediately.
Sorry I don't have any code samples to post right now (I may tomorrow), but just wondering if anyone has encountered anything like this before.