#Kasuni
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
Thanks
Are you using the Card Element? Or Payment Element?
I am using Payment element
You can listen to the 'change' event and check the complete attribute: https://stripe.com/docs/js/element/events/on_change?type=paymentElement#element_on_change-handler-complete
Let me check, maybe you can check it when you getElement(): https://stripe.com/docs/js/elements_object/get_payment_element
i tried it but think i cannot use change event because i use it inside checkbox click event .
After using getelement is there anyway to validate the element?
I don't think it's possible.
But you can listen to the event outside of the click handler, and store the current state in a variable. Then read the variable inside the click handler.
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Hi i was not clear in this. Can you bit explain?
how to get the state of payment element?
would you mind sharing your code snippet please?
sure
this is my checkbox click event
inside it i wanna get the stripe form validate status
you need to listen to the change event on the payment element and update a global variable with whether the input was complete or not https://stripe.com/docs/js/element/events/on_change?type=paymentElement#element_on_change-handler-complete
Hi After check input was complete or not, is there way to display errors in stripe elements?
it does that automatically as in-built functionality as far as I know.
is ther any way to call this manually?
in my case i wanna show errors before it goes to confirmpayment. This validations automatically showing only when i call to confirmpayment event
well it shows them if the user for example clicks to the next input automatically
as far as I know no
to be clear, did you try using this @west forge ? did it not help?
Hi yes using that method now i can check the inputs was complete or not.
But now i just trying to show errors , saying that form elements are required
well you can show you own message somewhere on your page to tell the customer the payment form is not complete
yes it is possible .that means we cannnot show default stripe form errors in situation liike this?
correct
Got it! thanks.
One more quetion , can we check inputs one by one( cvc, card number etc..) using this "change" event?
no that's not possible, it's for the entire element