Using Forms with Objects¶
Available Liferay DXP 7.4+
Liferay Objects are integrated with the Forms application, so you can design forms for receiving user input and creating Object entries. To do this, first add a new form and configure it to use the Objects storage type. Then select the desired Object, design your form, and map its fields to the selected Object’s fields.
Note
All Forms features are supported for Objects, including rules and validations. However, users cannot map Object relationships to form fields. See Designing Object Layouts for how to create custom layouts that include Object relationships.
Adding a Form for an Object¶
Follow these steps to add a form for creating Object entries:
Navigate to the desired Site, open the Site Menu (
), and go to Content & Data → Forms.
Click the Add button (
).
Click the Configuration button (
) for the new form.
Select both the Object storage type and the specific Object you want to connect with the form.
This configures the form to store data for the selected Object.
Note
Only published, active Objects appear. Also, a form can only be connected to one Object at a time, while Objects can be connected to multiple forms.
Click Done.
Once linked to the desired Object, you can add field elements to the form and map them to the Object’s fields.
Mapping Form Fields to Object Fields¶
Follow these steps to map a form field to an Object field.
Add a field element to the form.
Important
Object fields can only be mapped to compatible field types.
When mapped to a required Object field, the form field type is automatically set.
Click on the Advanced tab.
Select the desired Object field.
Repeat the above process until all desired Object fields are mapped to a form field.
Note
An Object field can only be mapped to one form field.
Design the form layout. See Forms documentation to learn more about designing forms.
Once you’ve finished designing the form, click Publish to finish form creation.
Important
Before you can publish an Object form, it must fulfill all mapping requirements.
After publishing, the form can be used to create Object entries for the selected Object.
Mapping Requirements¶
All forms with the Objects storage type have the following requirements.
All form fields must map to an Object field to prevent data loss.
All required Object fields must be mapped to a form field.
Attempting to publish a form with invalid mappings displays an error message that identifies what’s wrong.
Field Compatibility Reference¶
For Liferay 7.4 U20+
Object Field Types |
Compatible Form Fields |
---|---|
Attachment |
❌ |
Boolean |
Boolean (checkbox) |
Date |
Date |
Decimal (previously Double) |
Numeric → Decimal |
Integer |
Numeric → Integer |
Long Integer (previously Long) |
Numeric → Integer |
Long Text (previously Clob) |
Text |
Picklist |
Select from List, Single Selection |
Precision Decimal (previously BigDecimal) |
Numeric → Decimal |
Relationship |
❌ |
Rich Text |
Rich Text |
Text (previously String) |
Text, Multiple Selection, Grid, Color |