Thursday, December 14, 2017

New Orbeon Forms 2017.2 feature: undo and redo

Some Form Builder actions can have important consequences. For example, you can delete an entire section, or delete a control with carefully crafted validations.

Up until Orbeon Forms 2017.1, Form Builder asks you to confirm certain big operations, but not all. Further, even once you have accepted the operation, the changes are committed to the form. If you made a mistake, then your only option, if you haven't saved your form yet, is to give up all your changes since the last save and to reload the form.

The obvious solution to this problem is a classic undo/redo function, and this is exactly what we implemented in Orbeon Forms 2017.2. The toolbox now shows familiar undo and redo icons.

When hovering over the icons, a tooltip tells you which operation is undone or redone. You can undo most operations which change important aspects of the form:

  • control, grid, grid row, section and section template insertion and deletion
  • section template merging (new in 2017.2)
  • control renaming
  • control move via drag and drop (new in 2017.2)
  • section move up/down/right/left
  • control settings, including itemsets, labels, hint, and validations
We hope you will enjoy this new feature!

NOTE: In this initial version, it is not yet possible to undo changes to the form definition's source code with Edit Source, or changes to actions, services, and other global form settings. We hope to support undoing these operations in the future.

Thursday, December 7, 2017

Lease on documents

When two users have permission to edit the same instance of form data (also known as a document), there is a chance that they might inadvertently overwrite and lose changes done by another user.

This situation is illustrated by the diagram on the right. Say a first user, Homer, loads a document that contains "1" as the value of a field. Then say a second user, Marge, loads the same document. At that point, both Homer and Marge have the same document with the value "1" loaded in their browser. Now Homer can change the value from "1" to "2" and save. On her side, Marge can change the value from "1" to "3" and save. As result, Marge will overwrite the change done by Homer, and this without Homer or Marge knowing about it.

Orbeon Forms, starting with version 2017.2, provides a solution to this problem:
  • lease on a document is assigned to the first user, say Homer, who loads that document. The lease is given to Homer for 10 minutes, so if he lets it sit in his browser, after 10 minutes another user will, in turn, be able to edit the document. The lease is automatically extended when Homer makes changes to the document. Should he want to, he can also extend the lease explicitly by clicking on a "Renew lease" button. 2 minutes before the expiration of the lease, a dialog asks Homer if he wants to extend the lease so he can continue to edit the document. Finally, Homer can also explicitly relinquish the lease so to give other users a chance to immediately edit that document.
  • On the other hand, if a second user, say Marge, tries to edit the document while a lease was granted to Homer, then Marge is told Homer currently has the lease on the document, and is prevented from editing the document - this until the lease expires, or Homer explicitly relinquishes the lease.
Of course, the lease system is optionally enabled, and all the durations mentioned earlier are defaults, and you can change them if needed. With the new lease mechanism in place, you can easily avoid situations when multiple users edit the same document, making your form solution using Orbeon Forms safer and more reliable. For more on this, see the documentation on the lease feature.