Hi there,
We do not currently have a method for hooking into a JS event which fires before the form submit, but we are looking into introducing a javascript hook API which would allow for that sort of functionality. I don’t have a timeline for that new API.
For now, you’d essentially need to hack Give core (which is never recommended) or look for other workarounds.
Hi Ben!
I think it would be very appreciated with such a javascript hook. Meanwhile I’ve came up with a solution which really does not hack into your actual code, but is dependent of your current naming (and type) of one element. My hope relies on that you wont change name on this element (#give-purchase-button).
//Change name of submit so give plugin is
//not active after loading dom
jQuery(function ($) {
$('#give-purchase-button').attr('id', '
give-purchase-button-new').attr(
'name', 'give-purchase-new').prop('type','button');
//Same event handler as give has but uses
//this new button instead
$('body').on('click touchend',
'#give-purchase-button-new', function (e) {
//My code...
//Restore original name of button
//and event is simulated by click()
$('#give-purchase-button-new').attr(
'id', 'give-purchase-button').attr(
'name', 'give-purchase').prop('type','submit');
$('form.give-form input[name="give-purchase"]
.give-submit').click();
}
}
This above is a workaround that I found working and
I hope it would be some help if someone else needs
the same kind of functionality for now.
-
This reply was modified 7 years, 9 months ago by
wibergsweb.
-
This reply was modified 7 years, 9 months ago by
wibergsweb.
-
This reply was modified 7 years, 9 months ago by
wibergsweb.
-
This reply was modified 7 years, 9 months ago by
wibergsweb.