Closed Sbphillips19 closed 4 years ago
if (event.complete) {
if (event.elementType === "cardNumber") {
elements?.getElement(CardExpiryElement)?.focus();
}
if (event.elementType === "cardExpiry") {
elements?.getElement(CardCvcElement)?.focus();
}
}
works well
The above may or may not work for your specific use-case. It does work for simple forms that are in order. There are some accessibility concerns that may make this less than ideal depending on your page layout.
In all the examples if you use a single element which has all the fields in one input it automatically jumps over to the expiration field after validating the credit card number field.
If you want to instead have multiple fields then you need to tab or click through. Is there a way to use focus to jump from one field to the next? Can't seem to find any info on this and no examples show this functionality
Examples I am referring to:
https://stripe.dev/elements-examples/