#Chhay-card-number-element
1 messages ยท Page 1 of 1 (latest)
Which integration are you using? Payment Element or CardNumberElement only?
CardNumberElement, CardExpiryElement, CardCvcElement
Let me check how to do the validation on individual element
In the element, "change" callback supports the event changed: https://stripe.com/docs/js/element/events/on_change?type=cardNumberElement
You can use "event.complete" to validate whether the field is completed before confirming the card
yes, I can do it on event change
but what if the user submit the form without touching those fields, how the event change happen?
if the user doesn't touch the field, it means that the form is empty and you can prompt the empty error accordingly
So it means that we need to handle the React State "Required Fields" by our own
there is no any options in CardElement?
CardElement and PaymentElement do the validation whereas CardNumberElement alone doesn't
The state for individual element will be maintained on your side
No problem! Happy to help ๐