FortWest Posted October 8 Posted October 8 Site URL: https://www.joyrx.org/livestream-live I have added a very simple form block to a page of my site. The form only has one field — to enter a simple text message — with a "submit" button (see screenshot below). I'm looking for a solution that allows users to type a message, submit the form, and have the form auto-refresh without having to reload the page. Basically, I need users to be able to submit the form multiple times without reloading the page. Is there a solution for this? I have tried adding the following script to Website Tools > Code Injection > Footer: <script> $('button[type=submit]').on('click', function () { checkSubmitSuccess($(this).parent().parent()) }); function checkSubmitSuccess(formElement) { console.log(formElement) var i = 0; while (i < 10) { (function (i) { setTimeout(function () { if ($(formElement).hasClass("react-form-contents--submitted")) { console.log("Hereee") i = 10 window.location.reload() } }, 1000 * i) })(i++) } } </script> This script is not working for me. It looks like I'm getting a syntax error (see screenshot below). I'm not sure how to fix this to get it to work (refresh the form on "submit," not the page). Any help would be very much appreciated!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment