0

I'm having an (admittedly minor) issue using jQuery validation. I'm trying to validate a form to submit addresses. Within this form, there's a field group containing the City, State, and Zip fields.

It seems that because the zip code field is the last in the markup, its error message always 'trumps' the city error message. So if both the city and zip code are empty or otherwise invalid, the city field's error message won't display, and the zip code message will.

Does jQuery validation have a solution to this problem? Or am I going to have to fight against the framework to accomplish my goal?

Thanks!

Zjergens
  • 1
  • 1
  • 2
  • Isn't the common implementation for jQuery Validate to annotate the individual fields? – Jason Sperske Apr 29 '15 at 18:50
  • 1
    Show us your code. The demos here http://jqueryvalidation.org/files/demo/ show multiple error messages working just fine. – ekuusela Apr 29 '15 at 18:50
  • I can see how the [error container demo](http://jqueryvalidation.org/files/demo/errorcontainer-demo.html) would exhibit this behavior, and your options don't look good, maybe with some extra data in your markup like `data-error-priority=#` you could work out a way to reorder them – Jason Sperske Apr 29 '15 at 18:53
  • @ekuusela : Unfortunately I can't show you the code, as it's likely a violation of privacy agreements. Sorry, I can see how that makes it tough to help! Anyway, this link has similar code: http://stackoverflow.com/questions/1289086/jquery-validate-multiple-fields-with-one-error I'm using a 'groups' object, similar to this one from the link: groups: { DateofBirth: "DayOfBirth MonthOfBirth YearOfBirth" } My object holds the three address fields, which share one div to report error messages. My question is how to control which error message is displayed in the shared div. – Zjergens Apr 29 '15 at 19:06

0 Answers0