It is possible to save a node with a mandatory term reference field even if we let the field empty.

How to reproduce:

  • Create a vocabulary with some terms
  • Create a Content Type with a term reference field to this vocabulary
  • Make the field mandatory and choose the Autocomplete Deluxe widget and set the number of values to unlimited
  • Create a node of that content type
  • Try to save with the term reference field empty => This will not work, which is as expected
  • Now, save it with some terms selected
  • Edit the node again
  • Try again to save with the term reference field empty => This works and this is not as expected

If we try the same with another widget, it works as expected, namely: It should be impossible to save a node with an empty term reference field if that field is mandatory.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TheOptimizer’s picture

Status: Active » Needs work
tracker2k’s picture

tracker2k’s picture

Status: Needs work » Needs review
super_romeo’s picture

super_romeo’s picture

LNakamura’s picture

Thanks, @super_romeo - #5 works great for me, though it introduced a couple of minor coding standards issues. I went ahead and fixed those as well as some pre-existing ones and re-rolled your patch. Also including an interdiff.

LNakamura’s picture

LNakamura’s picture

FileSize
6.13 KB
6.74 KB

(Re)re-rolled my patch to incorporate recently merged updates...

edwardchiapet’s picture

Thanks @super_romeo and @LNakamura! Just tested this is looks great!

Will merge this into dev.

edwardchiapet’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.