Have successfully set up a form with the new CFv6 module. It starts a GoCardless recurring payment process on submit (as CFv6 is intended to work) however it also has a PayPal button using the Braintree payment processor. This button and the processing behind it has been added as a custom js script. In the heart of the script is an event listener that triggers when the button is clicked:
Essentially it works fine during testing, but I would like this button only to start PayPal processing, if the form data has been validated and is OK to submit. The use-CFv6-as-intended GoCardless submit button only continues the payment process, if the form has been validated - just as it should - , but the PayPal button will start the PayPal payment process even if the form data is not validated.
What event listener should I use in the custom js script to trigger only if the form data has been validated?
paypalButton.addEventListener('click', function (event) {...})
Essentially it works fine during testing, but I would like this button only to start PayPal processing, if the form data has been validated and is OK to submit. The use-CFv6-as-intended GoCardless submit button only continues the payment process, if the form has been validated - just as it should - , but the PayPal button will start the PayPal payment process even if the form data is not validated.
What event listener should I use in the custom js script to trigger only if the form data has been validated?
This is private content
Hi dzseti,
You may try this code, but I'm not sure if it will work:
so that code should be called when the button is clicked.
Best regards,
Max
You may try this code, but I'm not sure if it will work:
if(jQuery(paypalButton).closest("form").form('is valid') == true){
//run some code here if the form is valid
}
so that code should be called when the button is clicked.
Best regards,
Max
This topic is locked and no more replies can be posted.