So say I have a form (group edit contact form) to edit an object stored on my database, let’s call it contact. It has a name, a birthdate, and a checkbox for employed, each in their own groups within the group edit contact form.
The inputs are all disabled and linked to a custom state on the group edit contact form called Edit that by default is set to no.
There is an Edit button at the bottom of the form that when clicked triggers a workflow to change the custom state to yes, which enables all the inputs through a conditional statement on each, hides the edit button, and shows 2 new buttons, Cancel and Save.
When Save is clicked, a workflow changes the custom state Edit back to no, and updates the object with the new input values.
When Cancel is clicked, a workflow changes the Custom state Edit back to no, and should reset the inputs back to the original state (what was stored in the database for that object). This is what I’m having trouble with, as I’m having difficulty resetting the values.
For example: David, 1/1/1991, unchecked box. I go to edit the form, and change the date to 2/2/1992 and check the box. Then I have second thoughts and click cancel. Now the values stay on the screen, even though they are not saved in the database for that object.
This feels like it should be an easy thing to do, and I’m probably missing something obvious here, but I haven’t figured this out a clean way to solve this.
I realize that the reset inputs or reset group don’t work here as there were no fields processed through the workflow (since I didn’t save anything), so as a workaround I added a Make changes to a thing in the Cancel workflow using all the fields, but added a conditional that will never evaluate to true (this url is fakeurl.com), and then added the reset inputs afterwards. This worked, but it feels wrong, lol.
What would be a better way to solve this problem?