
Hi all
I have a gallery, and in that gallery is an edit button. Part of the code in that edit button sets a "HasChanged" variable to false. Other buttons then do slightly different things depending on whether the user has actually made any changes to the data.
It also sets a number of other variables, and resets a bunch of text inputs with defaults set to those variables.
The text inputs all have an on change code that sets the "HasChanged" variable to true.
The problem I am having is if I click the edit button, it sets all the variables as it should, resets all the text inputs and sets the "HasChanged" to false, but even with the "HasChanged" Set at the end of the edit button code, the text inputs reset to defaults after the button code ends and reset the "HasChanged" to true, despite no actual change being made.
Anyone come across anything similar before and have a non-janky workaround (I know I could do something like start a 1 second timer to reset "HasChanged" back to false after the defaults apply but there's gotta be a tidier way?)
Figured out a workaround in the end. On the text input on changes I added an IF so that instead of just saying set"HasChanged" true it says:
IF(every text input value = equivalent datasource value, set "HasChanged" false, set "HasChanged" true)