#JoelBermudez

1 messages · Page 1 of 1 (latest)

brisk radishBOT
gloomy spade
#

I want the check before continuing to confirmSepaDebit function

red kayak
#

Can you share what you're trying to check?

gloomy spade
#

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(()

red kayak
#

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?

gloomy spade
#

Yes

red kayak
gloomy spade
#

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!