treehouse : what would you like to learn today?
Web Design Web Development iOS Development

JQuery problem.

  • hey everyone,

    i hope all is well.

    i've been stuck on something for the past 3 hours... for those experienced in JQuery, it should be very easy...

    if you try to run "http://pastebin.com/m51a040cd" ... it will run smoothly BUT the problem is that if you fill the email in a wrong way, it will display the error but the page will still submit.

    i don't want the AJAX code to run unless all fields are working properly... these fields are "email and checkbox"

    any help?

    thanks in advance...

    mb
  • id try
    giving the submit button dIsabled="disabled" then,
    making a var valid = false and once it is true (everything checks out on the forum)
    remove the attr from the input button... but make sure you check the validation via php as well
  • Definitely something funny going on... by default the jquery validation plugin doesn't allow normal submission of a form until the validation errors are fixed. But I bet since you have build a custom action for that submit button that is getting through...

    You might have to write something custom to disallow that ajax submission part until validation passes. A little beyond a simple fix for my brain right now =)