Share

Say you have a Gravity Forms form which is displayed within a popup and uses ajax submission, right? The problem is that whenever you submit a form, close the popup and then reopen it the form will stay in its submitted state. One will have to reload the page to be able to submit the form for the second time.

This is quite troublesome. Say you had a form, which had a dynamically populated field (say, company name). The dynamic population of the company name field would be JavaScript based. Let’s assume that one would need to click on a trigger button which would show up the popup with the form and its dynamic field would have been updated with the company name. This would work as long as there was one single submission per each page reload. This is ugly as long as you have plenty of companies and you’d like to reload the form automatically after closing the popup, right?

This simple piece of JavaScript could should help you out. As always the code is explained in detail directly within the snippet.

The following two tabs change content below.
Senior Front End WordPress developer, blogger, traveller. Associated with Xfive, Goodie and WP doin. Working on YouTube channels. 8 years of experience working remotely.

Latest posts by Rafał Gicgier (see all)