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."

CommentFileSizeAuthor
#8 cck_multiple_values_required.patch1.54 KBscottsperry
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Cannot 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 :-)

markus_petrux’s picture

Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

For reference: the problem is in the following line in function content_multiple_value_form(), located in includes/content.node_form.inc

      $defaults = array(
        '#title' => ($field['multiple'] >= 1) ? '' : $title,      // This line is the cause.
        '#description' => ($field['multiple'] >= 1) ? '' : $description,
        '#required' => $delta == 0 && $field['required'],

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.

markus_petrux’s picture

Priority: Critical » Normal

Oops, we have replied almost at the same time.

yched’s picture

Title: Multiple Select Text Type: No Label in Error Message for Required Field » No Label in Error Message for Multiple Required Field
Component: text.module » General

Ah, 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...

markus_petrux’s picture

This 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.

yched’s picture

Status: Active » Closed (duplicate)

Right, let's call this a duplicate.

coltrane’s picture

Status: Closed (duplicate) » Active
scottsperry’s picture

Attached 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.

bbinkovitz’s picture

This 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