Skip to Content
0
Former Member
Apr 18, 2005 at 08:17 PM

Managing "isDirty" flag

271 Views

I have a view split into two separate parts: a tree on the left and a details form on the right for the selected element in the tree (there is actually more than one details form because there are different forms for the different levels in the tree). I would like the details forms to be directly editable (not using an edit button to pop up a modal version of the forms), but I am not sure how to handle the management of an "isDirty" flag.

Is there a way I can manage the "isDirty" state of the current record solely in the details forms? I want to do it this way so I don't have to map the "isDirty" flag to the other views on the window and check it at the beginning of every action that would cause the user to lose any "dirty" data from the details forms. I can see this getting very nasty very quickly as I would have to set up event handlers for yes/no/cancel (for the save confirmation prompt before losing "dirty" data) for pretty much each type of action. I say each type of action because I would have to differentiate between save and continue (for "yes" in the confirmation dialog) for "Go back to start page" and save and continue for selecting a different node in the tree (and so forth).

It seems like it would be much easier to manage the "isDirty" flag solely on the details forms so that I don't have to worry about what action caused the prompt. Maybe there is a better way entirely... because even this seems overly complicated. Any ideas?

Thanks,

-Dave