A way to tell if form fields in the app are dirty?

I have a working solution to share. Concat all of the original values of the fields into a variable. In my case the source is table.currentRow. Then do the same with the actual values in the form fields. Then in your Save button Disable When test just see if they are the same.

In my case I am using Temp State vars to hold the cached field states.

formDirtyCache1=
{{tblProducts.selectedRow.data.product_name +
tblProducts.selectedRow.data.town_id + 
tblProducts.selectedRow.data.price+
tblProducts.selectedRow.data.product_description+
moment(tblProducts.selectedRow.data.last_inventory_check).format('YYYY-MM-DD')}}

formDirtyCache2=
{{txtProductName.value +
selTown.value + 
txtPrice.value +
txtDescription.value +
moment(dtInventoryCheck.value).format('YYYY-MM-DD')}}  

Disable when on Button = 
{{formDirtyCache1.value == formDirtyCache2.value}}

If I need to use this in more than one place in the app, I could create another temp var keep it DRY:

formDirty = 
formDirtyCache1.value != formDirtyCache2.value}}

Notice how I need to do a little extra work on the dates because the table and the datetime picker return the date in different formats and I need to normalize these to get a proper comparison.

2 Likes