(15s) Hi, I'm going to show you some tips to make advanced forms in QGIS which will be easy for users to be filled. I also will show you those forms in the web thanks to Lizmap with no more configuration most of the time. This way you'll get more participation and less mistake in your data.
(20s) First with the QGIS "Drag and Drop Designer" we can: - Decide which fields needs to be filled - Change the field's order - Create tabs and group boxes
(35s) Let's say we create a form for a crowdsourcing campaign but also for logged in users in Lizmap (like people in our organization). This form have many fields but many of them are not mandatory so we don't want to show them all because when forms seem too long to fill, some users might give up and close it. To avoid that here we create a boolean field called `has_details`, with `Add details` as an Alias to have a more understandable title and define it as a `Checkbox`...
(15s) ...we also create a `Details` tab configured with a `Control Visibility by Expression` to only display it when the `has_details` checkbox is checked.
(10s) Here is the result. As you can see `Details` tab is only visible when `Add details?` is checked
(10s) Now we want people to upload photos. We create fields defined with the `Attachment` widget type and with a Filter to only display JPEG and PNG files
(10s) You can see in Lizmap, only files with defined extensions are displayed when selecting them
(10s) After file selection, you can also rotate or crop images. It is more convenient than to have to install a software for that.
(15s) When contributors are logged in Lizmap, we can use their user login or user groups in form's expressions thanks to expression variables. Here we create an invisible `login` field which get filled with the user login when form is saved.
(5s) The Value Relation widget is very convenient to display a list of value from another layer.
(10s) But sometimes the list can be very long. In this example, we display scientific names for amphibians and reptiles in France. To ease selection we could, for example, suggest the last previous record on top of the list for logged in users
(10s) For that, we create a layer from a view with this SQL query. It is a UNION ALL with the last previous record for logged in users and the whole list of animals
(20s) In red, the attribute table shows us the last record for alice, bob and demo users. The rest is the whole list of animals.
(15s) To only get the previous record for the logged in user in Lizmap we use this `Filter expression` which uses again the `@lizmap_user` expression variable
(15s) As you can see now when a logged in user saves a form he then has on top of the scientific name's list the last specie suggested.
(5s)