Design your first form

We assume that the reader of this document has at least basic knowledge about K2 SmartForms.

Views

Before you create a form, you’ll need to create one or more views. A view is a re-usable block of information you can place on a form. It contains controls, parameters, rules, and possibly a linked data source. A view comes in two flavors: item views and list views. Both are supported, but continue reading to check the supported features.

Item View

The layout of an item view starts with the question about the dimensions of the table you want. When displaying forms in the browser, the available screen is usually in landscape mode and you can use several columns next to each other. If you want to display this form in K2 Business Apps on a phone, you may want to limit the amount of columns.

List View

The list view forces you to link a data source, after which you can select what columns should be shown in the list. This time, you do not need to worry about the width of the screen. K2 Business Apps creates a block per row of the list view and each block shows the configured controls underneath each other.

Forms

A form is a collection of views and/or controls, accompanied by parameters and rules.

Limitations

The most important part is:

Note

Controls are only shown if they are on a view.

We aim to support controls directly on the form, but for now they can only be used to store data. All rules for the controls will still function when placed on the form directly.

Another important one is the limitation of list views:

Note

If a form contains a list view, only the list view - and one list view at most - will be shown.

The reason for this is usability. A form shown on a phone quickly becomes larger than the screen, thus allowing you to scroll vertically. When showing a list view, you want to be able to scroll - vertically - as well. Because we show just one list view, we use the entire screen to display it and the app only needs one vertical scrollbar. Now imagine multiple list views on a form. The app allows you to scroll the entire form up and down, but also each list list on its own. This is considered a bad user experience, hence our choice to not support it.

Screenshots

Form

../_images/tutorial-form-basic-android.jpg ../_images/tutorial-form-basic-ios.png

View

Each screenshot below shows four views. From top to bottom these are:

  • A view with a title that is collapsible

  • A view with a title that is not collapsible

  • A view without a title that is collapsible

  • A view without a title that is not collapsible. Not that the entire header is removed in this case.

../_images/tutorial-view-basic-expanded-android.jpg ../_images/tutorial-view-basic-expanded-ios.png ../_images/tutorial-view-basic-collapsed-android.jpg ../_images/tutorial-view-basic-collapsed-ios.png