savv Posted December 23, 2021 Share Posted December 23, 2021 Hello, Am new to processwire. Currently there is an issue where when a processwire form is filled, and whenever i refresh the browser the form submission are done automatically and message is shown. Any idea how we could avoid multiple submission and showing that thanks message again on the reload. Hope someone here could give a fix on this issue? Thanks, SAVV Link to comment Share on other sites More sharing options...
savv Posted December 23, 2021 Author Share Posted December 23, 2021 Just now, savv said: Hello, Am new to processwire. Currently there is an issue where when a processwire form is filled, and whenever i refresh the browser the form submission are done automatically and message is shown. Any idea how we could avoid multiple submission and showing that thanks message again on the reload. Hope someone here could give a fix on this issue? Thanks, SAVV Form get submitted whenever page is refreshed and shows Notice message everytime. How could we fix? Link to comment Share on other sites More sharing options...
MSP01 Posted January 5, 2022 Share Posted January 5, 2022 Are you refreshing the page right after you have manually submitted a form? If so then that's pretty normal behavior for forms and doesn't really have anything to do with Processwire. One way to stop it is to redirect to another page after the form submission. But if you don't want to redirect, this little piece of javascript should stop it from happening. Place it at the end of the page where the form is located. <script> if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } </script> Link to comment Share on other sites More sharing options...
rick Posted January 5, 2022 Share Posted January 5, 2022 On 12/23/2021 at 4:45 AM, savv said: Form get submitted whenever page is refreshed and shows Notice message everytime. How could we fix? That is an issue with your script. A form can only be 'submitted' by the user manually clicking the link, or by a script performing that action. Link to comment Share on other sites More sharing options...
savv Posted February 22, 2022 Author Share Posted February 22, 2022 On 1/5/2022 at 3:18 PM, MSP01 said: Are you refreshing the page right after you have manually submitted a form? If so then that's pretty normal behavior for forms and doesn't really have anything to do with Processwire. One way to stop it is to redirect to another page after the form submission. But if you don't want to redirect, this little piece of javascript should stop it from happening. Place it at the end of the page where the form is located. <script> if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } </script> SuppressError function was not working, Instead this javascript solved the issue!!! Thanks @MSP01 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now