Value relation dropdown does not autofill
Describe the issue
During feature creation in QGIS, value relation widgets will automatically populate with a value that satisfies the filter expression. This autofill works even when the default value expression is left blank. This functionality is not preserved in QField, which will only autofill a value when a default value is specified.
Reproduction steps
Steps to reproduce the behavior:
- Setup a value relation widget from a populated table in QGIS
- Add a feature, then check if the value relation field has a value
- Repeat the previous step in QField
Expected behavior
Both QField and QGIS should autofill the value relation field with the same appropriate value
Observed behavior
QGIS autofills the field, but QField leaves it NULL.
Desktop (please complete the following information)
- OS: Windows
- QGIS Version 3.38.0
- QFieldSync Version 4.10.1
Mobile (please complete the following information)
- Device: Samsung Galaxy A13
- OS: Android 14
- QField version: 3.3.10 (4bd923)
Additional information
- Problem started happening recently, didn't happen in an older version of QField: No
- Problem can be reliably reproduced, doesn't happen randomly: Yes
- Problem happens with all files and projects, not only some files or projects: Unknown
@cruelaid , a small sample project would help.
demo.zip Here you go!
It seems to boil down to QGIS and QField having inconsistent default behaviour. In QGIS you need to set 'Allow NULL value' to emulate the same behaviour as QField, i.e., not pre-populating with the first entry in the list of values. But it's harder to do it vice versa (have QField auto populate the first value in the drop down list).
Personally I prefer QField's default behaviour (default value is NULL unless specified in default value expression, or repeating from previous feature), as it's better for data validation in the field, and think QGIS should change instead, but given how long it's been this way in QGIS it might not be practical...