Thursday, August 27, 2020

Reloading resources for your form

Say you are overriding built-in resources:

  • because you'd like a button to be named differently,
  • or because you are localizing Form Runner in a new language,
  • or for some other reason want to change resources.

Then you might have noticed that your changes are not immediately taken into account, and you need to restart Tomcat, or other servlet container, before you can see your changes.

This is because, since resources don't change in production, they are aggressively cached by Orbeon Forms. However, if you're doing one of the aforementioned activities, having to restart the server to see changes done to your resources certainly isn't ideal.

Fortunately, since Orbeon Forms 2019.2, you can invalidate Orbeon Forms' resource cache for a given form, this from the Form Runner home page, by selecting the relevant form(s), and choosing Reload resources in the Operation menu.

Thursday, July 30, 2020

Introducing the JavaScript Embedding API

You can embed forms created with Orbeon Forms:

However, if you were not using Liferay and if your app wasn't written in Java, you were left to figure how to do embedding on your own. Through the years, a number of our customers have done just that, but going through this trouble just added unnecessary complexity. And this is why we are introducing, in Orbeon Forms 2020.1, a JavaScript embedding API.

When using the new JavaScript embedding API, as suggested by the name, embedding is done from the browser, which means that it doesn't depend on any particular server-side technology. Whether your app uses .NET, PHP, or any other technology on the server, you can use JavaScript embedding API.

If you have a case calling for forms to be embedded in your website, we hope you will find this new feature useful, and you can find more information about this API in the documentation.

Friday, July 17, 2020

Allowing users to view form data if they can't edit it because of a lease

Since Orbeon Forms 2017.2, you can enable the lease feature, on any or all your forms. If, in your setup, it is possible for multiple users to edit the same form data, you'll want to enable this feature to eliminate the possibility of conflicts, which is done by Orbeon Forms ensuring that at any given time at most one user can edit a given form data.

Until now, when users couldn't edit form data because another user owned the lease on that form data, they needed to wait for the lease to be released before they could edit the data. Since Orbeon Forms 2020.1, alternatively, they can ask Orbeon Forms to show the data in read-only mode.

We hope that you will find this enhancement to be useful.

Wednesday, June 10, 2020

Copying and pasting across forms

You might already know that Orbeon Forms supports cut, copy, and paste operations for the following items:
  • individual form controls
  • grids of controls
  • sections and their content
The cut and paste operations can be undone and redone with the "Undo"/"Redo" icons. All of this is available with the icon buttons at the top of the toolbox.


Before Orbeon Forms 2020.1, the cut/copy/paste operations were restricted to the currently running instance of Form Builder. They did not work between different Form Builder windows or tabs, or between edition sessions of the same form.

With Orbeon Forms 2020.1, we are improving this and these operations are now available between forms belonging to the same user session. For example, the following scenarios work:
  • Copy an item, go back to the Form Builder Summary page, reopen the same form or open a different form, and paste the item just copied.
  • Open several forms with Form Builder in different tabs or windows of the same browser (and the same browser user), and copy/paste items between these forms.
This allows more sharing between forms, including reusing parts of a form in other forms, copying sections from existing forms and pasting them into section templates for further reuse, and more.

We hope you will like this enhancement! See also the documentation.

Tuesday, May 26, 2020

The new Multiple File Attachments control

Orbeon Forms so far features two types of attachment controls:
  • File Attachment
  • Image Attachment
Recently, a customer kindly sponsored a new Multiple File Attachments control.

Until now, the only way to allow the user to attach an indeterminate number of files was to create a repeated grid and place the File Attachment control in it. This works, but it requires the form author to figure out how to do it, and it is not the most user-friendly user interface for the end-user.

The new Multiple File Attachments is much simpler: as a form author, you simply add the control to the form. It is also an improvement for the end-user: not only does it look better, but it is also much easier to use.

The new Multiple File Attachments control
You can reorder the files with drag and drop, remove one of the files with the "X" button, and download back the attachments (a function you can disable if you don't want it).

While we were at it, we also added a drag and drop area. Browsers have supported drag and drop of files for a long time and it was long due in Orbeon Forms. So when on a computer you can now simply drop one or more files directly to the attachment control. Alternatively, you can use the "Select Files" button and select one or more files at a time.

We also updated the existing single File Attachment control to have the same look and feel, as it badly needed a cosmetic refresh! In fact, it's now the exact same implementation. We are renaming it the Single File Attachment control.

The updated and renamed Single File Attachment control
When using the Multiple File Attachments control, the validation constraints that exist for the Single File Attachment control apply:
  • File type: You can filter the file types, for example images, PDF files, Excel files, etc.
  • Maximum file size: Here, the file size applies to each individual file. You can also set a maximum size for the entire form as was the case before.
We hope that you will like this improvement. It will be available in the upcoming Orbeon Forms 2020.1.

Wednesday, April 29, 2020

Validating a field against existing form data

Here is a scenario that a customer asked us recently: can you validate a field to make it invalid if its value already exists in data saved in the database?

The answer is that it is possible! Here is how, assuming you have a field called "Job" in your form that you must validate this way. First, create a service like this:



Here:
  • The path `/app/form` must be adjusted to your app/form names.
  • The path, in the XML, `section/job` must be adjusted to your section name/control name.
This service will call the Orbeon Forms built-in search service, asking to retrieve specifically the value of the "job" form control.

Mark the "Job" field as searchable by selecting the "Show in search" checkbox in the Control Settings dialog, so that the field is indexed and searchable in the database.

Then create an action that calls this service upon form load:



Store the service response into a dataset called "jobs":



Finally, add a constraint to say that you don't want the value of the field to belong to that set:



And that's it! The service will run on form load, store the list of all existing job values, then validate the current job value against all the existing values.



We should note that this has limitations, in particular, if another user saves new form data in the meanwhile, then the constraint will not be synchronized. An improvement could be to re-run the service before saving.

Monday, April 13, 2020

Dynamic loading of closed sections

In many cases, Orbeon Forms users choose to deploy forms that contain multiple sections using the wizard view. With that view, each section appears one after the other, so that the user typically navigates through steps to complete the form. Orbeon Forms features several validation modes, including "free", where the user can navigate freely between wizard sections, and "strict', where the user must fully complete a section before going to the next.

To improve performance, since Orbeon Forms 2018.1, each wizard page loads dynamically. So if you have a form with 20 pages (or sections), only one of them is present in your browser at a time.

But what about forms that don't use the wizard view? In this case, form sections appear on top of each other on a single web page. If all sections are open, there is not much we can do to reduce the size of the page to show the user. But sometimes, sections or subsections are initially closed.

Form with closed sections
You can configure this behavior in Form Builder by deselecting the "Initially Open" checkbox. (You can also explicitly make the section collapsible, although the default, configured by properties, also works unless you changed those properties in properties-local.xml.)

Controlling whether a section is initially open or closed
With Orbeon Forms 2019.2, we apply the same performance optimization we did to the wizard view: all sections and subsections that are initially closed load their content dynamically (or lazily) as the user opens them. This can help page loading times and performance in the browser, as there is less HTML markup to send and process on the client, especially when there is a large number of sections.

We hope you'll like this enhancement!