Skip to content

Latest commit

 

History

History
281 lines (153 loc) · 4.41 KB

File metadata and controls

281 lines (153 loc) · 4.41 KB

Forms: Which One Should I Choose?

To display and edit data in a form, SAPUI5 offers various form controls that are suitable for different use cases. This documentation outlines which form controls are available, and what features are supported by each one.

The following table gives an overview of form controls and their usage:

Overview of Form Controls and Supported Features

Form (sap.ui.layout.form.Form)

Simple Form (sap.ui.layout.form.SimpleForm)

Smart Form (sap.ui.comp.smartform.SmartForm)

Flexibility

1

3

2

Simplicity

3

1

2

Performance

1

3

2

Automatic responsive design

Yes

Yes

Yes

Accessible design

Yes

Yes

Yes

Controls inside are OData-bindable

Yes

Yes

Yes

Granular structure of a form control

Yes

No

Yes

Legend:

  • Rating:

    • 1: Best suited

    • 2: Average

    • 3: Least suited

  • Yes: Feature is supported for this form type

  • No: Feature is not supported for this form type

Form

Use sap.ui.layout.form.Form if you want to do the following:

  • Create a highly customized form

  • Display a large amount of data in a form

  • Create complex forms with multiple sections and different types of input fields

  • Have granular control over the structure of a form

  • Manage the responsiveness of the form yourself

Simple Form

Use sap.ui.layout.form.SimpleForm if you want to do the following:

  • Use a very simple structure of a form in a straightforward way

  • Create a form quickly and easily

  • Use a form that is automatically responsive

Smart Form

Use sap.ui.comp.smartform.SmartForm if you want to do the following:

  • Create and edit forms for SAP applications

  • Work with SmartField controls inside the form

  • Leverage the built-in data validation of SAPUI5 based on the OData model's metadata

  • Work with OData services and automatically generate form fields

Do not nest layouts and forms

Nesting can lead to undesired issues.

Do not use other forms or layout controls

Using any other form or layout control (for example,  HBox) as children of a form can lead to issues with accessibility or the responsive design. This applies to all form controls mentioned.

Use different form controls for different application requirements

Use the Form for performance-critical applications and also to have the most flexible design. Use the SimpleForm if you want the least complexity.