Auto save for forms

Anyone here knows if there is a way to implement an autosave in a form? I'm writing articles and it took me a long time. Sometimes I close the tab unintentionally. I think it would be good to save my form automatically each 30 seconds, probably using polling.
Solution
@pablopetr you can add the following method to the Pages/Edit{Resource}.php

public function updated(string $propertyName): void
{
    $this->save(
        shouldRedirect: false,
        shouldSendSavedNotification: false
    );
}


then add ->live() to the form elements and when they update it will call this method, then save.

note the propertyName is passed to the update method, so if you have some other elements you dont want to trigger the save on you can filter them out.
Was this page helpful?