#-mark-simpson-_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1402747214941524019
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello there
Hrmmm interesting. You don't see anything in your submit handler when you press enter?
At present i don't have a submit handler in JavaScrip - the form POSTs the data to the backend. And the code I have tries to make sure that the form is not submitted until the final button is pressed... but the Payment Element is submitting the form when Enter is pressed in one of its input fields.
I have now devised a way to make sure the form is not submitted even with this behavior - but I thought I should ask if this behavior can be turned off before committing my rather hacky "fix"
Hmm I think the expectation is that this would be the default behavior and that you would use an onsubmit attribute if you wanted to handle the enter key.
We basically just align with the default browser behaviors here for forms.
So I'm not sure it makes sense to disable by default.
Are you saying there is an onSubmit option to the Element (I didn't see it in the documentation) or are you just suggesting listening to the 'submit' event that is fired on the form?
OK, thanks for the info. I would have thought that my keypress handler which watches for 'Enter' would be fired when enter is pressed in the Payment Element but it doesn't seem to be.
I will fix my form's handling so that it cannot be submitted by anything other than the final button press.