#Fredo-disable-enter-submit

1 messages · Page 1 of 1 (latest)

tender abyss
#

Hey, how are you integrating? With the Payment Element?

outer cave
#

Wow you are super fast, I send you some screen

tender abyss
#

Thanks for sharing. This isn't really a Stripe specific issue, as it's just how <form> buttons work. You'll need to find a way to prevent/disable that with JavaScript. Ideas here: https://stackoverflow.com/questions/895171/prevent-users-from-submitting-a-form-by-hitting-enter

outer cave
#

I have already tried to block with the form but as soon as I do that, the entry of the customer's credit card information disappears

tender abyss
#

Why do you want to disable submit on enter? That an anti-pattern really (what if I can't use a mouse?)

outer cave
#

my form works only if the user clicks on the button that's why I don't understand, and as the entries are managed by stripe and not by me I don't know how to manage the system

tender abyss
#

I'm confused. You said you wanted to 'disable the enter button to send the form', but now it doesn't work?

outer cave
#

yes indeed when I press the enter button it gives me an error whereas if I press the button manually it works

#

I won't bother you any longer, I'll try to find a solution (anyway I have no choice 🙂 )
Thanks for your help

tender abyss
#

@outer cave I think you just need to add type="submit" to your button element

#

What error?

outer cave
#

it does not change anything

tender abyss
#

What's the actual error you're seeing?

outer cave
#

it refreshes the page while passing in my laravel controller

tender abyss
#

I think you need e.preventDefault() somewhere, but not sure how that works with PHP/Laravel

#

Ah, it's because you only have a 'click' event listener

outer cave
#

I'm looking into it, but otherwise I'm thinking of blocking the button until I have all the values (Card / CCV etc) and as soon as the values are present unblock the button

tender abyss
#

Yep, that sounds like good UX!

outer cave
#

but how to detect by your stripe field that all the information are well entered

tender abyss
#

That'll return a complete boolean you can check

outer cave
#

i try this thanks

#

What you have suggested adds something really cool, but for my problem I have removed the form tag in html