Basic example of “onPropertyModifiedStateChange”
The following example shows how to get notified whenever a value of a form’s property changes with just a few lines of code. Some css can be used to highlight the modified data. The password content is readable just for demo purpose.
Basic example of “onFormModifiedStateChange”
The following example extends example 1 and additionally tracks the modified state of the whole form using the
Example with reset buttons for properties
The following example shows a form with some more fields and introduces a reset button for every property that appears whenever the related property is in modified state. This especially is useful when dealing with big forms with a lot of fields for maintaining data.
As you can see you can add this functionality with just two rows of code within the
onPropertyModifiedStateChange()-Callback and some additional lines of code to create the buttons dynamically and register their event handlers.
To reset a property to its initial value we use two uicForm3 methods. One is for retrieving the initial value and one is to assign the initial value of a property to it’s current value. The property’s identifier is retrieved from the name’s attrivbute of the first form element within the property’s wrapper div.