#sadness-elements
1 messages ยท Page 1 of 1 (latest)
but still the submit event on the form is emitted
why is that a problem?
like you have a <form> with a submit button, naturally the event will happen
you'd use preventDefault to stop the form submitting and then can show validation errors. For example you call stripe.confirmCardPayment and if there's an error you can show them
for example look in https://jsfiddle.net/cdt43qL1/ at how it calls a setOutcome function that presents errors if there is one
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
this wouldn't be a problem if i would be able to set the card element status to invalid when the card element is not completed
but i can't :/
I want to show this red card when validation fails
It will happen when you call stripe.confirmCardPayment
but i only use the stripe.createPaymentMethod
to create payment method and send it to the server
Same thing
yeah the code I shared uses createPaymentMethod even, and does exactly this.
sadness-elements
hmmm i will try to review my code and send update here
ok it seems to work ๐ but i have another question: is there a way to set the card element status to invalid?
manually