I'm using a matrix field that has checkbox and textfield columns. None of them are required and I've verified that they are stored in the db correctly. Yet when I go to the form, all of the textfields throw required errors (even though they are not). It doesn't happen with checkboxes.
I commented out line 515 and that skips verification to get around this, but obviously not the ideal fix

if ($col['#required'] == TRUE && $values[$row_key][$col_key] == '') {
//form_error($element[$row_key][$col_key], t("Cell at %col x %row is required", array('%row' => strip_tags($element['#first_col'][$row_key]), '%col' => strip_tags($element['#header'][$col_key+1]))));
}

Comments

emilyf’s picture

Also, I tried to test this on latest dev but that appears completely broken when i upgrade to it. It was unusable so I stuck with the alpha release.

aasarava’s picture

I ran into this bug too. What you really need to do is look in the _matrix_process() function for the following code:

    case 'textfield':
      return array(
        '#type' => 'textfield',
        '#size' => $element['#size'],
        '#required' => $element['#required'],
        '#default_value' => $default,
        '#required' => TRUE,
      );

Notice the #required attribute is set twice, and the second time it is TRUE? Comment out the second one.

Can any of the maintainers let us know if there was some reason for forcing the textfield to TRUE? Or is this just a typo that needs fixing?

levacjeep’s picture

Priority: Normal » Major
Status: Active » Needs review

Could this be added to the dev?

Anonymous’s picture

I can confirm that this is still an issue in the 2.0 beta release.

I followed #2 and it solved the issue.

Should be committed!

intrafusion’s picture

Status: Needs review » Closed (won't fix)

Marking as Closed (won't fix) as the new co-maintainer will be focusing on D7