Designing A Form
We assume that the reader of this document has at least basic knowledge about K2 SmartForms.
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.
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.
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.
A form is a collection of views and/or controls, accompanied by parameters and rules.
The most important part is:
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:
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.
K2 Business Apps supports some special features that allows the K2 designer to tweak the layout a bit.
Since controls must be on a view, you are sometimes left with a view with just e.g. a single button on it. As views have a header bar containing the title and collapse/expand button on it and that header bar feels like overkill for a single button, we introduced a trick to remove it.
If you select a view on the form, you have the option to set its name in the property window. Give it whatever name you like, but append it with the text “ transparent” (no parenthesis, but including the space).