Notify User of unsaved data

Is there easy way to Notify a user of unsaved data? I have datatable with SelectColumn that save on change but just worried that when user is editing on form page that he will think same behaviour is there.
8 Replies
Patrick Boivin
I don't think there's an easy way (like a config) but it shouldn't be too difficult to implement around the Livewire updated() hook. It would make a cool plugin.
Matt Jenkins
Matt Jenkins17mo ago
Did you ever get anywhere with this?
OrdinaryDev
OrdinaryDev16mo ago
Any updates from this? I'm also in need of something similar.
SirFat
SirFat16mo ago
Did you try the hook as suggested to see if it fires? If it does then presumably it’s just a case of comparing what is against what was ?
OrdinaryDev
OrdinaryDev16mo ago
I am not familiar with how the hooks work within filament. Can you give me a quick example? @SirFat
SirFat
SirFat16mo ago
It’s 3:35am here so I cannot, however, it’s not a filament hook rather a live wire one. See: https://livewire.laravel.com/docs/lifecycle-hooks
Laravel
Lifecycle Hooks | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
OrdinaryDev
OrdinaryDev16mo ago
ah my bad. I am not seeing a way to utilize the updated hook inside of filament. They only over a few hooks and that is not one of them. At least not on the entire form. I can use it on a per field basis, but that is way too tedious. I did discover there is a getRawState which returns the current state of the form. So in theory, i should be able to compare the form data, to my eloquent model data and see if there is any changes. Thanks for pointing me in the right direction!
SirFat
SirFat16mo ago
No problem! If it works out be sure and put a comment on this thread with your solution and mark it as solved 🙂 good luck !

Did you find this page helpful?