-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
formStore.element.submit()
causes page reload at Qwik
#130
Comments
Did you check if the reload can be prevented by an argument or |
Sorry for less information.
I would like to simulate the first behaviour for the second case. Is there a way to do that? |
I don't know. Probably I would not use the "submit" function of the |
I see. If I call the function directly, how can I validate the form? |
For example, this comment form here is possible to submit by hitting Command+Enter with validation. |
You can call |
I see, I will use it. Thank you :) |
@fabian-hiller I have tried to call the |
Oh, yes that's right. I will think about it. Until then, I recommend using |
Thanks :) |
I tried to simplify the workaround a bit 😅, here is mine: // Old-school solution:
// "cancelable" has to be true. It allows modular-forms to preventDefault that "submit".
form.element.dispatchEvent(new Event('submit', { cancelable: true, bubbles:true }));
// Or for modern browsers
form.element.requestSubmit(); @fabian-hiller Let me know if you are interested in a PR for a Related discussion:
|
Does this work without specifying a submitter as the first argument? |
Yupp, in that case the form element itself is used as submitter :). |
Ok, feel free to create a PR for a |
I would like the form to submit programmatically equivalent to the manual submit.
But I couldn't find the recommended way to do that in document.
So I call the
formStore.element.submit()
but it reload the page, although the form doesn't reload when to submit manually.How we can correctly submit the form programmatically with validation and without to reload?
The text was updated successfully, but these errors were encountered: