Skip to content

Instantly share code, notes, and snippets.

@gterrill
Last active August 29, 2015 14:01
Show Gist options
  • Save gterrill/7b51e7e437c42e930576 to your computer and use it in GitHub Desktop.
Save gterrill/7b51e7e437c42e930576 to your computer and use it in GitHub Desktop.
How to validate the booking form
$('form[action*="/cart/add"]').submit(function(e) {
var btaForm = $(this).data('bta.bookingForm');
if ((typeof(btaForm) != "undefined") && !btaForm.isValid()) {
e.stopImmediatePropagation(); // prevents BTA's default form submit handler which also checks for validity
return false;
}
// regular Ajax submit from here...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment