I have Gallery to select records and Form to edit data. Normally, when user edited data on a Form and didn't yet submit, when changing the selection in the Gallery - all unsaved Form data is lost. I want to prevent the user from selecting new record in Gallery until user clicks Submit or Discard. I've been working with following solution:
Gallery OnSelect:
If(
Form1.Unsaved,
Notify("Save Form before selecting another record!", NotificationType.Warning),
Set(varCurrentItem, ThisItem)
)
Form1 Item:
varCurrentItem
It works partially. The warning pops up and the Gallery prevents me from changing the record, but when I SubmitForm my Form, data is submitted but the Form remains Unsaved (i know that, because save button Visible property is set to Form1.Unsaved , and the button is still visible).
Thanks for any suggestions. Perhaps i'm approaching this wrongly, and there is actually a simpler solution to preventing loosing unsaved data on Gallery item selection?