In QGIS 3.16 I set up a relation between two tables.

In the child-table I set a constraint-expression and checked "Enforce expression constraints".

If I add one or more features to the child-table which have attributes, which are not valid, QGIS recognizes them as "invalid" as expected but:

  1. I can still toggle editing mode for child layer - although some data in child-layer is "invalid"
  2. I can still save the parent-layer ("OK"-Button is not disabled) - although some data in child-layer is "invalid"

How can I prevent the user from saving invalid data in both cases without python-scripts (like How can i prevent a form from closing unless data is accepted by validation) ? (I thought to set up a constraint-expression and "Enforce expression constraints" in the parent-table, which checks all child-feature data - but there seem not to be a way to do this.)

I'd like not to use Python because:

  1. I have a parent-/child-relation (which is -as far as I know - very complicated to realize with custom forms) and
  2. I'd like to use this project in QFIELD, which has - as far as I know - limitations with custom-forms - so I use drag and drop-forms

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.