Skip to content
Snippets Groups Projects
Commit 089d1f0e authored by Joshua Walker's avatar Joshua Walker
Browse files

Merge pull request #94 from agh1/cividiscount-compatibility

Don't process form when discount code added
parents 1f948c12 7368be5d
No related branches found
No related tags found
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.
Finish editing this message first!
Please register or to comment