Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
(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
- Create a vocabulary "foo" with terms "bar" and "baz".
- Add a term reference field to a content type:
- Select widget
- Required
- 2 allowed values
- Give the authenticated role the following TAC grants:
- foo vocabulary default: A/A/I/Y/Y
- bar: A/A/I/N/Y
- While logged in as an administrator, create a node tagged with "bar".
- 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
Comment #1
xjmComment #2
xjmThis 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()
.Comment #3
xjmThere's no real way to "get in before"
_form_validate()
. That means we should:(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.
Comment #4
xjmFixed in:
http://drupal.org/commitlog/commit/364/97ad4675bc4abfb25b73dcf8dd36b564c...
Comment #5.0
(not verified) CreditAttribution: commentedUpdated issue summary.