• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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: 67752
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: 67752
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.
  •  
    She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic