I am looking to determine if at least one field in my form has been altered. When this condition is met, the disableButton
variable will be set to true, and false if there are no changes in the form. Here is the snippet of code I am currently using:
// The array 'this.hold' temporarily stores the initial form values for comparison
if(this.data.process == 'update') {
for(const f in form.value){
if (form.value[f] == this.hold[f])
this.disableButton = true;
else
this.disableButton = false;
}
}
The issue here is that the button only gets disabled when ALL fields have changed. What adjustments should I make to my condition or inside the for loop?