Forums

Form Caching/Resetting Form

gotpowr 09 Sep, 2024

Is there a way to reset a form/clear a session as if it's being opened for the first time?

I'm having an issue where variables are not getting properly cleared if I navigate away from the form and back using the back button, or clicking elsewhere and clicking the form again.

So for example, I have 2 models a "submission" and a "savedoptions"

If the user is looking at a saved submission, then:

Field 1 = submission.field1

However, if it's a new submission, I'm using the variables to replace  with another value

Variables: Request, submission.field1, {var:savedoptions.field1}

Works great for what I need on first navigation.  When the user chooses a "new submission", they see their saved option and don't have to enter that data (but can edit if they choose).

However, if I click "new" (loads correctly) and navigate out and back in any manner (back button, clicking the form link, navigating to another page and then clicking the form link), and choose a saved submission, I'm not seeing the correct data.  Instead of showing me the submission.field1, it's showing me the value from the savedoptions.field1.

It seems the form is not being reloaded when the link is clicked on, or the back button is being used.  I am not using site caching.  Any way I can force the form to reload fresh on every launch?

simelas 10 Sep, 2024

Hi,

some time ago,....i had the same issue and solved it by adding a form area without fields and only a save button. Then action was save that empty form and redirect to the submission form. 

gotpowr 10 Sep, 2024
Answer

Thanks!  I actually found a solution that worked today.

So I had the variables set on the "not found" part of the read data.

I added an additional variables set on the "found" part of the read data.

In that section, I literally added:

Variables: Request, submission.field1, {var:submission.field1}

As silly as that sounds, it actually worked in resetting the data.  I flipped back and forth multiple times and ways and was able to:

Use the saved submission data when exists

Use the "saved options" data when submission doesn't exist.

It's strange, but it works!

You need to login to be able to post a reply.