views:

27

answers:

1

Hi,

I have a web form which is split up into several HTML pages.

I am using the validation plug-in to check fields on submit and this is working great.

The spec says that users should be able to navigate through the form, both linearly (just using the submit buttons to go from page to page) and also to skip to any particular page.

I have a unordered list with the links at the top of each page. I'm looking to fire the validation both on submit and when one of these links is clicked but don't know if this is possible.

For info, I'm currently firing the validation this way:

$("form#courseDetails").validate({
  rules: {
      studiedBefore: "required" //Have you studied with us before
  },

  messages: {
      studiedBefore: "Please indicate whether you have studied with us before."
  }
});

Each form has an ID and validation for all the forms is in one JS file.

Not that it really matters, but the navigation is in <ul id="tabNav">

Any help much appreciated.

Thanks, Phil

+1  A: 

Check the .valid() method it provides. If you call that in click handlers attached to your links, you should be ok.

nickf
Thanks Nick. Believe it or not I've looked up and down the documentation but missed that. I've tried the code on a simplified version of my form and it works great! Thanks again.
Phil Molloy
no worries, Phil. People round these parts show appreciation with them pretty voting controls over on the left there... Just sayin' ;-)
nickf
Yeah sorry, I was about to do it then got called into a meeting.
Phil Molloy