Warn or prevent unsaved changes

Put up a warning when attempting to move away from the page in the browser when there are unsaved changes on a form or table?

Retool does this when editing queries, but it would be a great feature when using the app which I don't believe it does and I can't think how I could implement this?



Use onBlur?
The onblur event occurs when an object loses focus . The onblur event is most often used with form validation code (e.g. when the user leaves a form field).

@ScottR - Could you elaborate more on your idea? For example, I have a editable table. When a user makes changes in the table, if they don't hit the save button and go to a different site or close the browser - there is no warning telling them, "Hey dummy - you haven't hit the save button yet." Ha

I don't really want to save after every change because it creates a lag in the save and refresh and makes the workflow quite slow.

I feel like any time a form is partially filled/ a table changeset is not null a warning should be presented. I would usually do this with window.onbeforeunload, but I don't think that is an option.

I think you can only get around the Save changes button is to add a customized one and initiate the Bulk edit from that button and if that button is not clicked(not sure if you can detect that when leaving the page - perhaps a temp state?) then show the warning.... that being said I believe that was possible in the Legacy Table component but may not be available for the new Table component....

Could you check for the changeset variable with the Blur event?

Yes, you could check if it is empty or not....
if({{yourTable.changeSetArray !="") do something.....