Bug report #20516

Can't remove a constraint set on a field once saved

Added by Timothe Perez about 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:High
Assignee:Julien Cabieces
Category:Forms
Affected QGIS version:3.4.2 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28336

Description

Hi,

While playing with constraints in the Attributes Form tab in a vector layer properties, I have found that once any constraint expression (valid or not) is saved, it is impossible to clear the constraint expression.
How to reproduce (tested on shapefile and postgis layers):

1. create a vector shapefile layer with a dummy field
2. go to the layer properties => Attributes Form
3. select the dummy field
4. type any random constraint expression (valid or not)
5. if your clear the input box before hitting apply, the expression will be empty as expected
6. if you hit apply, then any attempt to clear the input box will cause it to display its last saved value when the input lose focus

It seems that there is no way to clear it (aside deleting the layer); if I open the expression dialog it does not allow blank expression and if I just write a space it will be saved but it's an invalid expression thus I will have a warning when I edit a feature.


Related issues

Duplicated by QGIS Application - Bug report #21006: Expressions cannot be cleared/removed in attributes form ... Rejected 2019-01-15

Associated revisions

Revision 1c343292
Added by Julien Cabieces almost 6 years ago

Allow expression widget to be empty so expression could be removed (#9032)

  • fixes #20516 : Allow Constraint widget in attribute type form to be empty so expression could be removed

per widget modification

  • correct tests
  • Add the clear button on field expression widget when widget is allowed to be empty
  • Change API since version to 3.6

Revision 48068c26
Added by Julien Cabieces almost 6 years ago

Allow Constraint widget in attribute type form to be empty so expression could be removed (#9229)

  • fixes #20516 : Allow Constraint widget in attribute type form to be empty so expression could be removed
  • Change 'since' version to 3.4.6

History

#1 Updated by Giovanni Manghi about 6 years ago

  • Status changed from Open to Feedback

Does it work as expected on 2.18?

#2 Updated by Timothe Perez about 6 years ago

I tried the same procedure on 2.18.24 and it's working as expected: when the input box is cleared, the expression stays empty.
Also I just tried this on 3.2.3 on Windows and the behavior is the same as in 2.18: it gets cleared.

#3 Updated by Giovanni Manghi about 6 years ago

  • Status changed from Feedback to Open
  • Regression? changed from No to Yes
  • Priority changed from Normal to High
  • Operating System deleted (OpenSuse Leap 15)

#4 Updated by Regis Haubourg about 6 years ago

  • Affected QGIS version changed from 3.4.1 to 3.4.2

Confirmed here with 3.4.2. It is a blocking regression.

#5 Updated by Giovanni Manghi about 6 years ago

Regis Haubourg wrote:

Confirmed here with 3.4.2. It is a blocking regression.

I agree, is completely breaking the workflow of many.

#6 Updated by Alexander Bruy almost 6 years ago

  • Duplicated by Bug report #21006: Expressions cannot be cleared/removed in attributes form properties added

#7 Updated by Julien Cabieces almost 6 years ago

  • Assignee set to Julien Cabieces

#8 Updated by Julien Cabieces almost 6 years ago

  • Pull Request or Patch supplied changed from No to Yes
  • Resolution set to fixed/implemented

#9 Updated by Harrissou Santanna almost 6 years ago

  • Resolution deleted (fixed/implemented)

As far as I can see, the PR is not yet merged

#10 Updated by Julien Cabieces almost 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF