• Resolved ayavilevich

    (@ayavilevich)


    Hi,

    I have a contact page with WPForms. I am also using Litespeed caching plugin on the site.
    Few days after cache flush, form stops working and returns:
    “The form was unable to submit. Please contact the site administrator.”

    It seems that the form element of WPForms has a data-token attribute which isn’t valid anymore. At least this is the only detail in the page that changes if I flush cache again.

    What is this attribute? Does it have a limited validity period? How long? Is this documented somewhere?
    Please provide this critical information so that people could setup proper caching on their contact pages.

    Regards, Arik.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @ayavilevich,

    It is possible that your caching plugin has some script minifier which might be breaking the scripts used by WPForms which is causing the issue.

    When you get the chance, can you please check if you can exclude that pages that has a form from being cached?

    Another option would be to exclude the JS file that is used by WPForms. Kindly check your plugin setting and exclude the following file: /wp-content/plugins/wpforms-lite/assets/js/wpforms.js from being cached.

    I hope this helps!

    Thread Starter ayavilevich

    (@ayavilevich)

    Hi @jadeam ,

    This is not about minification as it works fine at first.
    Your form element has a parameter called “data-token”. It seems this element is valid for 2-3 days and after that needs to be regenerated. If the page is cached the form stops working. Need to make sure to restrict cache to less than 2-3 days.
    In my case I configured LiteSpeed to do a daily cache purge for the “contact us” page. I hope it will work.

    Hello @ayavilevich,

    Thanks for reporting back.

    You are right about the caching issue which breaks the data-token causing the error. Normally, excluding the pages where the forms are present should do the trick to avoid any of the form’s functionality from having unexpected issues.

    I hope you got it sorted and please let me know if you have other questions.

    Hi @ayavilevich,,

    We haven’t heard back from you in about a week, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

    Hi
    I confirm the following action solved the issue:
    – go to ‘LiteSpeed Cache’ settings in your WP Dashboard
    – go to ‘Cache’ sub-menu
    – send select the ‘Excludes’ sheet
    – send input the URI of your contact page in the ‘Do Not Cache URIs’ field
    And that solves the issue ??
    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“The form was unable to submit” related to caching and data-token’ is closed to new replies.