Attributes Form

Add a alias on a field

Usually, the field names are defined without accent, spaces and can’t be very long. In Layer Properties ‣ Attributes Form and clicking on a field, you can add an alias.

This will be used to substitute the field name when possible for a more friendly name.

Layer Properties ‣ Source Fields, you can the list of alias defined on the layer.

Customize the edition form

In Layer Properties ‣ Attributes Form and clicking on a field, you can setup the form.

To set the editing tools for your layer fields:

  • In Layer properties ‣ Attributes Form.

  • By selecting first a field on left panel, select the Widget type:

    • To hide a field, choose Hidden. The user will not see the field in the form. There will be no content inserting. Use it for the primary key.

    • To add a read-only field, unchecked Editable checkbox.

    • Special case of the option Value Relation. You can use this option for a Lizmap map. For users to have access to information of the outer layer that contains the data, you must enable the publication of the layer as a WFS layer in Project properties ‣ QGIS Server ‣ WFS.

Предупреждение

Lizmap Web Client does not know the «QT Designer UI file» for form generation. Therefore only use the Autogenerate mode or Drag and drop mode for editing layers.

Примечание

To make the field compulsory you have to define it as NOT NULL in the properties of the table, in the database, not in QGIS –> Layer Properties.

Примечание

All the editing tools are not yet managed by Lizmap Web Client. Only the following tools are supported:

  • Text edit

  • Classification

  • Range

  • Value Map

  • Hidden

  • Check Box

  • Date/Time

  • Value Relation

  • Relation Reference

If the tool is not supported, the web form displays a text input field.

Advanced form

Примечание

To group fields in different tabs, follow the QGIS documentation about the drag and drop form.

Lizmap can reproduce several behavior configured in QGIS :

  • Control visibility by expression.

    For example, you can toggle tab’s visibility based on a checkbox state.

    1. Create a field named has_photo defined as a Checkbox widget

    2. Create a photo tab having:

    • Control Visibility by Expression checked

    • Expression with "has_photo" = true OR "has_photo" = 't'

  • Constraints defined by expression.

    For example, you want to simply assert users correctly type a website URL beginning by http (of course, a regular expression would be better but we keep it simple).

    1. Create a field named website defined as a Text Edit widget

    2. Define the Constraints

    • Expression with left( "website", 4) = 'http'

    • Expression description with Web site URL must start with 'http'

  • Filter expression for a Value Relation field.

    For example, you want a field to automatically get the related value from another layer’s field when drawing a point on the map.

    1. Create a field name quartier (neighbourhood in French) defined as a Value Relation widget

    2. Set the parent layer to another layer quartiers

    3. Set Filter expression with intersects($geometry, @current_geometry)

    4. We can also check Not null and Enforce not null contraint to assert no NULL value can be set.

Совет

As shown in the video above, it’s not possible anymore, natively, to have the combobox showing the area clicked automatically after the click on the map. The combobox has an empty value as a first item but has still a single value in the dropdown menu with the name of the neighbourhood clicked on the map.