When a node_reference / user_reference field is inside a field_collection the autocomplete validation handler causes a ton of PHP Notices on form submission (and also does not work).

This is because the validation handler - trying to get hold of the field and instance arrays hunts for them in $form_state['field']. However when the element is being provided by a field_collection they cannot be found here.

This affects both node_reference and user_reference.

Comments

jamsilver’s picture

Status: Active » Needs review
StatusFileSize
new2.91 KB

The attached patch passes the $field and $instance arrays explicitly to the autocomplete_validate handler as properties of the element, which should be a more robust solution in general.

jamsilver’s picture

The attached patch here is a re-roll of the above patch using git diff --no-prefix. Useful for those using drush make.

yched’s picture

Status: Needs review » Closed (duplicate)

Oops, missed that issue. Fixed in #1126566: autocomplete widget doesn't work in field_collection widget. Grab latest -dev.