Attributes Form

Aggiungere un alias ad un campo

Solitamente, i nomi dei campi sono definiti senza accento, spazi e non possono essere molto lunghi. Nel Proprietà livello ‣ Attributi Moduloi cliccando su un campo, puoi aggiungere un alias.

Questo verrà usato per sostituire il nome del campo, quando possibile, con un nome più amichevole.

Proprietà livello ‣ Campi sorgente, puoi vedere la lista degli alias definiti per il livello.

Personalizzare il form di edit

Nel Proprietà livello ‣ Attributi modulo cliccando su un campo, puoi impostare il modulo.

Per impostare gli strumenti di editing per i tuoi campi del livello:

  • Nel Proprietà Livello ‣ Attributi Form.

  • Selezionare prima un campo nel pannello di sinistra, poi selezionare la Widget type:

    • Per nascondere un campo, scegli :guilabel: Hidden. L’utente non vedrà il campo nel modulo. Non ci sarà alcun inserimento di contenuto. Utilizzalo per la chiave primaria.

    • Per aggiungere un campo di sola lettura, deseleziona la casella di controllo Editable.

    • 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.

Avvertimento

Lizmap Web Client non conosce il «QT Designer UI file» per la generazione dei moduli. Quindi usare solo la modalità Auto o la modalità Trascina e rilascia per modificare i livelli.

Nota

Per rendere il campo obbligatorio devi definirlo come NOT NULL nelle proprietà della tabella, nel database, non in QGIS –> Proprietà livello.

Nota

Tutti gli strumenti di editing non sono ancora gestiti da Lizmap Web Client. Solo i seguenti strumenti sono supportati:

  • Modifica testo

  • Classificazione

  • Intervallo

  • Valore Mappa

  • Nascondi

  • Casella di controllo

  • Data/Ora

  • Relazione Valore

  • Relazione Riferimento

Se lo strumento non è supportato, il modulo web visualizza un campo di input testuale.

Form avanzato

Nota

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

Lizmap può riprodurre diversi comportamenti configurati 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'

  • Vincoli definiti dall’espressione.

    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'

  • Default value defined by expression.

    In Layer Properties ‣ Attributes Form ‣ Defaults, the Default value of a field can be any QGIS expression, using the geometry or other fields, for instance:

    • round($area, 2), $x, $y, $length…

    • "firstname" || ' ' || "lastname"

    The value is computed when the form is opened, and computed again when the geometry is drawn or modified, and when a field used in the expression is changed. Fields must be written with double quotes, like "firstname", to be detected.

    When modifying an existing feature, the value is only updated if Apply default value on update is checked. The value is also saved for a read-only field.

    For a new feature, the default value of the database has priority.

  • Espressione del filtro per un campo Value Relation.

    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.

  • Background color of tabs.

    The background color set on a tab in the Drag and drop designer is used for the tab in the Lizmap form.

Suggerimento

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.