guillaumepotier / Garlic.js

Automatically persist your forms' text and select field values locally, until the form is submitted.
http://garlicjs.org/
Other
2.36k stars 176 forks source link

Destroy fields before initialization #121

Open Orlandster opened 6 years ago

Orlandster commented 6 years ago

Is there a way to destroy and clear the values before the form gets initialized?

This is my code:

$form.garlic('destroy'); // destroy all fields
$form.garlic({ expires: lifetime * 60 }); // init garlic

The thing is all the fields get destroyed, but will still be visible. I need to reload the page to get the clean form. Is there a function to clear all form values?

Or mayby it should be manually possible to initialize garlic.

Thanks for taking the time!

guillaumepotier commented 6 years ago

Hi there,

I did not recall having set a clear form function into garlic. This is something I think you would have to implement yourself, web has plenty questions on that topic.

What is your use case, why do you need to do that?

Best