FormitSaveForm and FormitSaveLoadForm - multiple form submits in CMP

my snippet call

[[!FormIt?
&preHooks=`FormItLoadSavedForm`
&hooks=`FormItSaveForm,redirect`
 &updateSavedForm=`values`
&formEncrypt=`1`
&redirectTo=`256`
&redirectParams=`{"savedFormHashKey":"[[+fi.savedFormHashKey]]"}`
&formName=`TestForm`
&formFields=`value01,value2`
]]

I am trying to figure what needs to be in each call.
I have a page where the form is created and redirect to the page where you can then edit the form - the next time I click submit - it creates a new form in the CMP rather than updating the current form.

I have tried redirecting to the same page and putting a slightly different snippet on a second page and redirecting their.

You probably need to add a field savedFormHashKey to the form, so FormIt knows what form to update.

<form action="[[~[[*id]]]]" method="post">   
   ...
   <input type="hidden" name="savedFormHashKey" value="[[!+fi.savedFormHashKey]]" />
</form>
1 Like

Out of interest if a user returns to the form page after a log out or browser clear the form is blank. Do I need to revert to migx2db or should I be able to grab the form again using these hooks

As far as I can tell you should be able to load the form data again, if you add savedFormHashKey as a GET-parameter to the url with the correct hash key.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.