• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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: 67663
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: 67663
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.
  •  
    I think she's lovely. It's this tiny ad that called her crazy:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic