Form Element Sets

If you’re here looking for information on reusable field sets, you’re in the right place. We call them Element Sets in the Liferay Forms application because these sets include more than just fields: they include the layout and configuration of the fields as well. In the future, additional styling elements will be available here, too.

Element sets are more like composable Form fragments or reusable Form blocks.

Sometimes you might be able to create an entire form by composing existing Element Sets. Your colleagues might call you lazy, but we’d call you industrious.

Creating Element Sets

To create Element Sets, go to Site Menu → Content → Forms. The Forms view is displayed by default. Click the Element Sets tab, and any existing Element Sets appear, just like existing Forms are displayed in the Forms view. Click the Add button (Add).

Here’s the thing. If you know how to create a Form, you already know how to create an Element Set. The process is identical. Drag and drop elements onto the form builder palette, configuring fields as you go.

When you’re finished, click Save. Element Sets aren’t publishable, so there’s no button for that.

Figure 1: Creating Element Sets is just like creating Forms. You just cant publish them.

Figure 1: Creating Element Sets is just like creating Forms. You just can't publish them.

Once an Element Set is saved, it’s instantly available for use, even in the same Element Set. That’s right, you can use Element Sets to create Element Sets.

Using Element Sets

To use an Element Set in a Form:

  1. Open the Form Builder.

  2. If the Add Elements sidebar isn’t already displayed, open it by clicking the Add button (Add).

  3. The default view in the Add Elements sidebar is Elements. Instead click Element Sets.

  4. Drag the Element Set onto the Form Builder, just like you would any single Form Element.

Figure 2: Add an Element Set the same way you add other Form Elements, like fields.

Figure 2: Add an Element Set the same way you add other Form Elements, like fields.

You probably already guessed that the process is identical for using Element Sets to build other Element Sets. That’s all there is to it. There are just a couple more things to note:

  • Once an Element Set is added to a Form, there’s no connection with the root Element Set. You’re free to move or configure the Fields and Elements however you want.

  • Editing an Element Set doesn’t retroactively affect the Forms where the Element Set was used.

Think ahead. Are there some common fields you’ll commonly need to configure in your Forms? If so, create them as Element Sets once and save yourself repetitive work.

« Action: CalculateData Providers »
Was this article helpful?
0 out of 0 found this helpful