Command to clear local storage?


I was wondering if there is a command available to clear local storage when a form loads? I have noticed that the values in local storage are quite sticky and subsequent access to a form with different prefill values is ignored.

I guess this product suggestion is related: Bug: Hidden fields pre-filling vs local storage priority issue

The local storage is great if someone comes back to a form which wasn’t submitted. Though if they coming to the same form for a different reason the new hidden values driving the form will not be used.

Any suggestions?

You can use JavaScript to clear local storage using localStorage.clear(), but this is pretty destructive and I wouldn’t recommend doing this on behalf of users.

Alternatively, due to the order of precedence with respect to how answers are set on a form, you can append force=1 onto the query string to override automatic save and resume later, which is what causes values to “stick” on subsequent loads of a form that has not yet been submitted (as submission effectively clears the form).