Closed (duplicate)
Project:
Entity reference
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2014 at 14:47 UTC
Updated:
10 Feb 2015 at 18:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ndobromirov commentedI tracked the issue to the fact that the #title property in the different autocomplete widgets is left empty for some reason.
Created a simple patch that fixes it.
Comment #3
ndobromirov commentedRequesting retest, because on a local environment Drupal 7.25 and the latest stable versions for ctools entity and entityreference, all the tests pass with OK.
Comment #4
ndobromirov commented1: entityreference-field-title-is-empty-on-validation-2170253-1.patch queued for re-testing.
Comment #6
seanbApplied the patch manually and it seems to work. Not sure I'm a fan of the title suffix, but it is still better then not having any feedback.
Comment #7
artusamakHere a patch that should solve it the right way.
Comment #8
chewie commentedlast patch looks good. Work for me
Comment #9
mrharolda commentedChecked; with untranslated and translated field labels.
Comment #10
mforbes commentedThis issue is not specific to entityreference fields. Try making a content type with only text fields, all required, some with "number of values: 1" and some "number of values: [2-10 or unlimited]". If you submit the node/add form completely blank to generate required messages for each field, the single-value fields say "Foo field is required." while the multi-value fields say "field is required."
I think this is because with a multi-value field, you have 1 visible label for the whole table, and the actual inputs within the table rows do not have a visible label (save for the red asterisk, which is silly and redundant since the visible label also has a red asterisk, but that's another story). It's the actual input that is tested during the "required" check, and when the test fails, that input's label (which doesn't exist) is used for the "[label] field is required" error message.
The code that builds the error message needs to detect that the input has no label but the parent element (the table) does have a label, and use that parent label instead.
This also occurs when the "Add another item" button is clicked while there is no value in the first input. The AJAX operation results in a local "field is required." error message right above the input (as opposed to at the top of the form, where it will appear upon submitting the whole form). The code that builds the error message for this local rendering also needs to be fixed.
Therefore, perhaps this is actually a bug in the core field module, so that is where a patch should be applied, not here.
EDIT: To clarify, when I say "Add another item" obviously this only applies to unlimited cardinality. However, the original issue (submitting the whole form) actually exists even if the number of values is set to an integer like 2-10.
Comment #11
alexiswatson commentedA fix is coming in core with a backport for D7, effectively making this a duplicate of https://www.drupal.org/node/980144