52
Our web forms are really complex. What's a great solution for extensible form validation, preferably one that works with jQuery?
Background:
Our site has a bit of Ajax, but the real focus is on user experience through about 20 multi-page forms or "wizards." These forms are complicated.
- Presentation: Some fields are floats or ints. Validation means stripping non-decimal characters, but we also want to make sure that, if a user enters
5into a price field, the field is updated to5.00. - Side effects: Some fields have side effects when updated. E.g., updating the price or quantity of an item needs to update a subtotal field.
- Widget-driven elements: Some fields are hidden and have values populated by widgets. E.g., a map widget lets you point to a location and a hidden field is updated with latitude-longitude coordinates, but the location must be within a certain region.
- Groups: Some fields are groups, like address/city/state/zip, and should only be validated when all of the fields have bee populated.
- Server-side validation: Validation of some fields requires back-end checking via Ajax requests
- Multiple forms per page: Sometimes a user needs to fill out one form before a dialog opens with another form. A framework has to be more versatile than binding to
onSubmit— we sometimes post multiple forms in order from the same page using Ajax. (E.g., we let users sign up and create a widget in one swoop but, due to legacy systems, that flow requires two POST requests.) - Customizable error display: Sometimes errors appear above fields, sometimes the field style changes, and our new designs call for tooltip-like popups (ala qTip) for some errors.
- Snappiness: