Skip to content
Snippets Groups Projects
Commit 7368be5d authored by Andie Hunt's avatar Andie Hunt
Browse files

Don't process form when discount code added

parent 700ad967
Branches
Tags
No related merge requests found
......@@ -58,7 +58,19 @@
$submit = $form.find('.button-primary');
}
else {
$submit = $form.find('input[type="submit"]');
$submit = $form.find('input[type="submit"][formnovalidate!="1"]');
// If CiviDiscount button or field is submitted, flag the form
$form.data('cividiscount-dont-handle', '0');
$form.find('input[type="submit"][formnovalidate="1"]').click( function() {
$form.data('cividiscount-dont-handle', 1);
});
$form.find('input#discountcode').keypress( function(e) {
if (e.which == 13) {
$form.data('cividiscount-dont-handle', 1);
}
});
$submit;
}
if (isWebform) {
......@@ -98,6 +110,10 @@
// Intercept form submission.
$form.submit(function (event) {
// Don't handle submits generated by the CiviDiscount button
if ($form.data('cividiscount-dont-handle') == 1) {
return true;
}
if (isWebform) {
var $processorFields = $('.civicrm-enabled[name$="civicrm_1_contribution_1_contribution_payment_processor_id]"]');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment