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.
There seems to be a bug in the validation of Text module that occurs when both the text field is set to allow multiple values and is set to required. The field is being validated properly as "required," but the label is not passed properly during validation. The error simply says "field is required." as opposed to "[Field Name] is required."
Comment | File | Size | Author |
---|---|---|---|
#8 | cck_multiple_values_required.patch | 1.54 KB | scottsperry |
Comments
Comment #1
yched CreditAttribution: yched commentedCannot reproduce. I do get the label in the error message.
What's the label of your field ?
Besides, CCK doesn't control the error messages about missing required fields. Those are generated by core validation.
PS : there's no way this can be considered critical :-)
Comment #2
markus_petrux CreditAttribution: markus_petrux commentedFor reference: the problem is in the following line in function content_multiple_value_form(), located in includes/content.node_form.inc
The error is issued by FAPI, in _form_validate() where expects to have something in the element title, but CCK empties the title for multiple value fields because it is displayed on top of the drag'n'drop table.
Fixing this would require leaving the title for FAPI, but removing it during render processing or something similar. Tricky.
Comment #3
markus_petrux CreditAttribution: markus_petrux commentedOops, we have replied almost at the same time.
Comment #4
yched CreditAttribution: yched commentedAh, OK. The issue title mentioned 'Select', so I tested a text field with a select widget.
Got it. Tricky indeed, because we'd need to find a way to make this work for all field types / widgets - without requiring them to handle the special case themselves...
Comment #5
markus_petrux CreditAttribution: markus_petrux commentedThis issue could end up fixed by #196421: Deleting unwanted multiple values / multiple values delta issues. If we can find the way to check for requirements in nodeapi('validate'), then we can probably build the error message with the correct field label.
Comment #6
yched CreditAttribution: yched commentedRight, let's call this a duplicate.
Comment #7
coltrane#196421: Deleting unwanted multiple values / multiple values delta issues didn't fix this. I'm still seeing it on 6.x-2.8
Comment #8
scottsperry CreditAttribution: scottsperry commentedAttached is a patch for 6.x-2.9
It sets the title in content_multiple_value_form() even if multiple values and unsets it in theme_content_multiple_values() so it is not displayed for every value.
Comment #9
bbinkovitz CreditAttribution: bbinkovitz commentedThis also occurs on Drupal 7.22. If you found this issue searching for this problem and you're using Drupal 7, the patch is here: https://drupal.org/node/980144