In previous QGIS versions there was no way to check the validity of values entered by a user for a feature's attributes. Now, a user can specify a constraint on each widget in an layer's attribute form. Constraints are created using QGIS' expressions, eg "min_population" > 50000
. A "Not Null" checkbox is also available to indicate that a value must be entered for the field. Additionally, descriptive text can be added to give the user helpful feedback when a constraint fails.
Constraints are evaluated on the fly while a user is modifying a feature. A tooltip is available on any field having a constraint, showing the constraint's expression, the result of the evaluation and a description of the constraint. A message bar will also displayed at the top of the form summarizing any fields which do not meet the constraint criteria.
This feature was funded by the QWAT project and the Canton of Zug, Switzerland
This feature was developed by Matthias Kuhn (OPENGIS.ch) / Paul Blottiere (Oslandia)