#JoelBermudez
1 messages · Page 1 of 1 (latest)
I want the check before continuing to confirmSepaDebit function
Can you share what you're trying to check?
When using the iban.on('change' ... the event.error works good. If I click outside the input, it shows the error.
But, if I'm still on the input and I directly click the submit button, first completes the form function and then shows the error. I want to verify the structure of the iban, like on the iban.on change, but when sending the form before executing stripe.confirmSepaDebitPayment(()
If I click outside the input, it shows the error
Do you mean if you complete filling the IBAN information and click outside of the IBAN element/inputs, the error will be thrown?
Yes
Does event.complete (https://stripe.com/docs/js/element/events/on_change?type=ibanElement#element_on_change-handler-complete) remain as true if you click outside of IBAN inputs?
Ok, event.complete solves the problem
iban.on('change', (event) => {
const displayError = document.getElementById('error-message');
if (event.error) {
displayError.textContent = event.error.message;
activacionSubmit.disabled = true;
} else if (event.complete) {
displayError.textContent = '';
activacionSubmit.disabled = false;
} else {
displayError.textContent = '';
activacionSubmit.disabled = true;
}
});
Thanks!