• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jquery validate and ajaxsubmit wont work together

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My jsp looks like this:


Inside submit Id click i have a ajaxSubmit. Outside i have a validate(). My validate works fine with just jquery.validate.min.js import. But then when i included this ajaxSubmit in submit click function and imported jquery.form.min.js my validate() just wouldnt work and without the field validations my action gets submitted and returns exceptions since validations arent done. If i just remove the jquery.form.min.js validate() works just fine and shows ajaxSubmit is invalid and property doesnt exists. Now that I have included no debug error messages but validate() wouldnt work.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't want to do things this way; it's not compatible with how HTML works. You should never put a click handler on a submit button!

Don't submit the form yourself. Use ajaxForm() to set up the form for Ajax submission, and then let HTML submit the form in its normal way.

To perform validation, use a summit handler on the form, not a click handler.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also some tips:
  • Use lowercase for HTML; not uppercase.
  • Use proper indentation in your code. It's really hard to read as it is.
  • reply
      Bookmark Topic Watch Topic
    • New Topic