Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions src/layer/display-instructions/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Display instructions in the form using Text and HTML widget
# How to Display Instructions in the Form
The HTML and Text widgets can be used to display instructions in the form, as described in [Informational Widgets ](../info-widgets/).

Sometimes, you may want to include instructions or tips for surveyors in your forms. <QGIS link="" text="QGIS" /> offers Text and HTML widgets that can be used for this purpose. Your text instructions can include [expressions and field values](#using-expressions-in-text-and-html-widgets) as well. The HTML widget supports various [HTML tags](https://doc.qt.io/qt-6/richtext-html-subset.html#supported-tags), so it can be also used, for instance, to display [online images](#using-html-widget-to-display-online-images-and-other-online-resources).

These widgets can be found in **Available Widgets** in the **Other Widgets** section when using the [Drag and Drop Designer](../form-layout/#qgis-drag-and-drop-designer).
Expand Down Expand Up @@ -39,32 +41,3 @@ Clone <MerginMapsProject id="documentation/form_cascade" /> to follow this examp
... and this is how it works during the field survey. `[% "VRP" %]` expression displays the current value of the `Vehicle Registration Plate` field.
![Mergin Maps mobile app text widget with variable](./mobile-text-widget-expression.jpg "Mergin Maps mobile app text widget with variable")

## Display online images and other online resources using HTML widget {#using-html-widget-to-display-online-images-and-other-online-resources}
The **HTML widget** can be also used to display online images in the mobile app or open online resources, such as PDF files, videos or websites, in the browser of your device.

::: tip
Clone <MerginMapsProject id="documentation/forms-display-images-and-files" /> to how this works.
:::

Here are HTML samples you can use to [configure the HTML widget](#using-expressions-in-text-and-html-widgets). Your form should contain a text field for storing the full URL link (here: `link`).

To use these samples, replace `link` by the name of the appropriate field in your layer.

- show image in the form

```html
<script>document.write(expression.evaluate("'<a href=\"'||attribute( @feature, 'link' )||'\"><img src=\"'||attribute( @feature, 'link' )||'\" width=300></a>'"));</script>
```

- display a text (`here is your link`) with a link that can be opened in a browser
```html
<script>document.write(expression.evaluate("'<a href=\"'||attribute( @feature, 'link' )||'\">here is your link</a>'"));</script>
```

Make sure that the HTML widget works before taking it to the field by testing it in the <MobileAppNameShort />. It should look something like this:

![HTML widget in QGIS and in Mergin Maps mobile app](./qgis-mobile-html-form.jpg "HTML widget in QGIS and in Mergin Maps mobile app")

::: warning Image preview in QGIS 3.36+
QGIS may not display the preview of the online image if you use QGIS 3.36 or higher. Despite this behaviour, the <MobileAppNameShort /> displays it correctly. Therefore we recommend trying the setup by opening the form in the <MobileAppNameShort /> to make sure it works as intended.
:::
28 changes: 14 additions & 14 deletions src/layer/embed-image/index.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Using HTML widget to display online images and other online resources
The **HTML widget** can be also used to display online images in the mobile app or open online resources, such as PDF files, videos or websites, in the browser of your device.
# How to Embed an Image
[[toc]]

::: tip

## Photo
A photo can be displayed in the form as described in [Displaying photos in QGIS](../photos/#displaying-photos-in-qgis).

## Online image
The [**HTML widget**](../info-widgets/) can be used to display online images in the <MobileAppNameShort /> as described in [Using HTML widget to display online images and other online resources ](../info-widgets/#using-html-widget-to-display-online-images-and-other-online-resources)

::: tip Example project available
Clone <MerginMapsProject id="documentation/forms-display-images-and-files" /> to how this works.
:::

Here are HTML samples you can use to configure the HTML widget. Your form should contain a text field for storing the full URL link (here: `link`).

To use these samples, replace `link` by the name of the appropriate field in your layer.
Your layer should contain a text field for storing the full URL link (here: `link`).

- show image in the form
To show an online image in the form, configure the HTML widget with this expression (replace `link` with the name of the appropriate field in your layer):

```html
<script>document.write(expression.evaluate("'<a href=\"'||attribute( @feature, 'link' )||'\"><img src=\"'||attribute( @feature, 'link' )||'\" width=300></a>'"));</script>
```

- display a text (`here is your link`) with a link that can be opened in a browser
```html
<script>document.write(expression.evaluate("'<a href=\"'||attribute( @feature, 'link' )||'\">here is your link</a>'"));</script>
```

Make sure that the HTML widget works before taking it to the field by testing it in the <MobileAppNameShort />. It should look something like this:
value-re
![HTML widget in QGIS and in Mergin Maps mobile app](./qgis-mobile-html-form.jpg "HTML widget in QGIS and in Mergin Maps mobile app")

![HTML widget in QGIS and in Mergin Maps mobile app](./qgis-mobile-html-form.webp "HTML widget in QGIS and in Mergin Maps mobile app")

::: warning Image preview in QGIS 3.36+
QGIS may not display the preview of the online image if you use QGIS 3.36 or higher. Despite this behaviour, the <MobileAppNameShort /> displays it correctly. Therefore we recommend trying the setup by opening the form in the <MobileAppNameShort /> to make sure it works as intended.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed src/layer/embed-image/mobile-forms-layout.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/mobile-forms-layout.xcf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-add-group-tab.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-add-group-tab.xcf
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-configure-html-widget.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-configure-html-widget.xcf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-configure-text-widget.jpg
Binary file not shown.
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-drag-n-drop.gif
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-add-group.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-add-group.xcf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-spacer-widget.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-spacer-widget.xcf
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-tabs-groups.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-tabs-groups.xcf
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-text-html.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-text-html.xcf
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-value-map-roads.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis-form-value-map-roads.xcf
Binary file not shown.
Binary file added src/layer/embed-image/qgis-mobile-html-form.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/layer/embed-image/qgis-mobile-html-form.xcf
Binary file not shown.
Binary file not shown.
Binary file removed src/layer/embed-image/qgis_forms_layout.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/qgis_forms_layout.xcf
Binary file not shown.
Binary file removed src/layer/embed-image/spacer-widget-forms.jpg
Binary file not shown.
Binary file removed src/layer/embed-image/spacer-widget-forms.xcf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/layer/external-link/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# How to Use Hyperlinks
[[toc]]

Attributes forms can include clickable links that can be used to [open a link in a browser](#open-link-in-a-browser) or [open a navigation app](#open-link-to-a-navigation-app) directly from the form in <MobileAppName />.

## Open link in a browser

1. Right-click on a layer, select **Properties** and go to the **Attributes form** tab.
Expand Down
16 changes: 8 additions & 8 deletions src/layer/one-to-n-relations/index.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# How to Link Multiple Records to One Feature
[[toc]]

You can follow this example by cloning <MerginMapsProject id="documentation/forms_one-to-many-relations" />.

:::tip
Make sure that your survey layer has a **unique UUID** field to correctly link records to the feature. You will find detailed steps how to set it up in [How to Attach Multiple Photos to Features](../attach-multiple-photos-to-features/)
:::

It is often the case that you have a set of spatial features and you want to record their status every now and then.

It is often the case that you have a set of spatial features and you want to record their status every now and then. For example, there is a GIS layer representing the manholes and the surveyors carry out regular inspections of the manholes using <MainPlatformNameLink />. Instead of duplicating the manhole layer and recording each inspection as a new feature, inspections can be recorded in a non-spatial table that is linked to the spatial layer. This way, multiple records can be linked to one feature.
For example, there is a GIS layer representing the manholes and the surveyors carry out regular inspections of the manholes using <MainPlatformNameLink />. Instead of duplicating the manhole layer and recording each inspection as a new feature, inspections can be recorded in a non-spatial table that is linked to the spatial layer. This way, multiple records can be linked to one feature as a [one to many relation](../relations/).

The image below shows the manhole locations and a form with listed inspections in <MobileAppName />.

![Multiple inspections linked to one point in Mergin Maps mobile app](./mobile-1-n-relation.jpg "Multiple inspections linked to one point in Mergin Maps mobile app")


:::tip Example project available
You can follow this example by cloning <MerginMapsProject id="documentation/forms_one-to-many-relations" />.
:::

The manhole point layer has the following attribute table:

| fid | Manhole | Manhole UUID |
Expand All @@ -22,7 +22,7 @@ The manhole point layer has the following attribute table:
| 2 | 2 | `{be01b98f-3585-49d4-be74-4cf3530a2989}` |
| 3 | 3 | `{03178264-0070-45c8-a981-b2474627d7e0}` |

This layer contains only information about the manholes. `Manhole UUID` values are generated using [`uuid()` function as a default value](../attach-multiple-photos-to-features/) when a feature is created. This ensures that these values are **unique** even when multiple surveyors capture new features at the same time. This field will be used to link inspections and manholes.
This layer contains only information about the manholes. `Manhole UUID` values are generated using the [`uuid()` function](../relations/#generating-unique-ids-uuid) when a feature is created. This ensures that these values are **unique** even when multiple surveyors capture new features at the same time. This field will be used to link inspections and manholes.

:::danger Using UUID
**Why UUID?** FID can be changed during [synchronisation](../../manage/synchronisation/). As a result, records can end up being linked to wrong features.
Expand Down
11 changes: 7 additions & 4 deletions src/layer/open-file/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# How to Open a File
[[toc]]

A local file, e.g. a PDF stored in the project folder, can be opened from within the form. This can be achieved by using [the HTML widget](#using-html-widget-to-open-local-files) or setting up [default values](#open-local-files-using-default-values).

In the <MerginMapsProject id="documentation/forms-display-images-and-files" /> public project, both alternatives are used. You can download or clone this project, to compare them and see what works the best for you.
::: tip Public project available
Download or clone our public project <MerginMapsProject id="documentation/forms-display-images-and-files" /> to explore both options and see what works the best for you.
:::

## Using HTML widget to open local files
The HTML widget can also be used to open local files: for instance, a locally stored PDF file can be opened from within the form during the survey.
The HTML widget can be used to open local files: for instance, a locally stored PDF file can be opened from within the form during the survey.

::: tip Example project available
There is a public project <MerginMapsProject id="documentation/forms-display-images-and-files" /> you can download or clone to see how the setup works.
This setup is used in our public project <MerginMapsProject id="documentation/forms-display-images-and-files" />.
:::

- A PDF file named `my-pdf.pdf` is stored in the main [project folder](../../manage/project/#mergin-maps-project-folder) as it needs to be packaged with the project.
Expand All @@ -27,7 +30,7 @@ In the <MobileAppNameShort />, you can tap the *Open File* link to open the PDF
Default values can also be used to open local files (e.g. a PDF file) from within the form. This file needs to be packaged with the project, so it should be stored somewhere in the [project folder](../../manage/project/#mergin-maps-project-folder).

::: tip Example project available
There is a public project <MerginMapsProject id="documentation/forms-display-images-and-files" /> you can download or clone to see how the setup works.
This setup is used in our public project <MerginMapsProject id="documentation/forms-display-images-and-files" />.
:::

- A PDF file named `my-pdf.pdf` is stored in the main project folder.
Expand Down
Loading