PDA

View Full Version : Manipulating Dirty state



ChrisR
15 Oct 2007, 6:14 AM
Is there a way i can manipulate the dirty state of a form? I'm currently trying to implement the following scenario


I've got a tree in the west panel, when i click a tree node a form in the center panel gets populated with the selected tree item's data (JSON).

When someone alters some fields and then selects another node without first saving i'm displaying an alert that he needs to save first or else loose his changes. Easy enough with form.isDirty().

Now when he does alter some fields (turning the form dirty) and then saves, the form is still dirty even though it has been successfully saved and thus should be no longer dirty. The the user gets the alert again even though he already succesfully saved his changes.

how can i update the dirty state to false after the form has been saved?

tryanDLS
15 Oct 2007, 8:27 AM
The form.isDirty fn just loops thru all the Fields, calling Field.isDirty. This check is not checking the saved state of the data as an indication of dirty - it just compares the current value to the original value. I would think it would be pretty simple for you to override that functionality to provide your own implementation.