(This issue occurs with #1214472: Undefined index: und in taxonomy_access_form_alter() -- incorrect assignment of language key applied).

Apparently some form validation for required fields happens before our validation callbacks are used.

Steps to reproduce

  1. Create a vocabulary "foo" with terms "bar" and "baz".
  2. Add a term reference field to a content type:
    • Select widget
    • Required
    • 2 allowed values
  3. Give the authenticated role the following TAC grants:
    • foo vocabulary default: A/A/I/Y/Y
    • bar: A/A/I/N/Y
  4. While logged in as an administrator, create a node tagged with "bar".
  5. Log in as a regular user. Edit the node body without changing the taxonomy field, and attempt to submit the node

Expected result

The node remains tagged with "bar" and no other terms.

Actual result

The node fails validation with error "Foo field is required"

Comments

Title:"Foo field is required" when submitting a multiple-value select with only disallowed terms"Field is required" when submitting a multiple-value select with only disallowed terms

This message appears in options_field_widget_validate(), but something else is throwing the error before that. Edit: unfortunately, in the beast that is _form_validate().

There's no real way to "get in before" _form_validate(). That means we should:

  1. Change our approach entirely (yuck), or
  2. Un-disable and re-select the disallowed defaults on submission.

(2) seems reasonable since we are already making the change with jQuery. I'm less confident in it being a good solution with #1209154: Form UX: disabling vs. hiding disallowed terms and #1209122: Provide better graceful degradation when jQuery is not available., but it would at least prevent our JQuery from totally breaking this sort of field, so we should fix this first and then provide a better solution later.

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

Issue summary:View changes

Updated issue summary.