Re: [Xsltforms-support] Dialog OK vs. cancel
Brought to you by:
alain-couthures
From: COUTHURES A. <ala...@ag...> - 2010-02-02 21:52:02
|
Hey Micah, > Now that we have dialogs (thanks Alain!) we are looking in to ways to make them work with two possible close cases, OK and Cancel (equivalently, the X button in the upper-right). > > What do people think of this technique? > > 1) Create a separate instance called "undo". Upon opening the dialog, copy over the main instance data into "undo". If the user dismisses the dialog with OK, proceed as usual. If the user hits cancel or X, copy the stored instance back over the first one, thus rolling back whatever changes had been made in the dialog. If you have nested dialogs, you'd need to be more careful. > > Is there a better/more straightforward way to accomplish this? > The close attribute described at http://www.w3.org/MarkUp/Forms/wiki/Dialog?highlight=(CategoryXForms12) can be used to know that an internal back up is to be done of instances data. Then I would suggest another action to abort changes and hide the dialog such as xf:abort or xf:rollback Maybe xf:commit could also be defined for a more explicit back up and xf:reset could have an extra attribute to specify state to be restored.... It wouldn't be very difficult to implement this in XSLTForms because for each instance there is already a single srcXML Javascript property. Turning it to an array might be the solution. What do you think? Thanks! -Alain |