Jump to content

processwire form submission on every refresh....fix to avoid?


savv
 Share

Recommended Posts

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

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

  • 2 weeks later...

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

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

  • 1 month later...
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...