I'm creating a form on some features in GGIS.

How do I display a message error if a field of a feature is null?

I do not want to use QtCreator.

2 Answers 2


You can set constraints in the layer properties form. Double click the layer in the TOC and go to the fields tab. Click the Edit Widget button for the field you want to change

enter image description here

  • Thanks for your answer I did this but it doesn't allow you to write a message that would be desplayed if the field is null. Jul 26, 2017 at 10:48
  • In constraint there is a field wich asks you to add a description. Jul 26, 2017 at 12:30

There is also a python way of doing this opening a message box if the field value is NULL (QtCreator or python plugin not required), see:

Set a Required Field in QGIS Edit Form

Just to add a little more content to this answer, the python code will have to be copied to the layer Properties>Field tab and change the Python int function drop down value to "Provide code in dialog" and include the function name in the Function Name text box (like formOpen).

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.