I have a page which calls an external library, this library adds a payment form:
<form name="multipay_form" onsubmit="private_payment_send(); return false;"> ....</form>
I can not change any code here. I need to call a function after form is submitted. What I have done is:
jQuery('form[name="multipay_form"]').on('submit', function() { alert("myfunction");});
Which works ok, but there is one exception, the method "private_payment_send()", does form validation, I need to know if their function returned true or false, to be able to trigger my function or not.
Is this possible?. I want to avoid doing the validation again on my end, since if they add new field or any new rule I would have to do the same on my code, which is not optimal. Any ideas?
Is there a way to unattach the function from the form through javascript?, in that way I can call private_payment_send() from my function