function tablefield_field_is_empty($item, $field) {
...
$count_rows = $item['tablefield']['rebuild']['count_rows'];
...
}

content of $item
111

tested on form submit. As result field treated empty and $items array of tablefield_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) is empty and nothing is saving

Notice: Undefined index: rebuild in tablefield_field_is_empty() (line 486 of /var/www/extranet/sites/all/modules/tablefield/tablefield.module).

Drupal core - 7.58

What should be

  $count_rows = 0;
  if(isset($item['tablefield']['rebuild'])) {
    $count_rows = $item['tablefield']['rebuild']['count_rows'];
  } else {
    $count_rows = count($item['tablefield']['tabledata']);
  }

Comments

Mykola Dolynskyi created an issue. See original summary.

mykola dolynskyi’s picture

Issue summary: View changes
lolandese’s picture

Thanks for reporting. Can you supply this as a patch for the latest dev version so I can test and possibly commit it with attribution to you?

lolandese’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Priority: Critical » Major

Critical is for bugs that make a module completely useless. It is a major bug though as revisions should work. See https://www.drupal.org/node/45111 for more info.

mykola dolynskyi’s picture

@lolandese thank you for fast reaction.

I dont know how to supply patches/gits in drupal.org environment.

Basically line

$count_rows = $item['tablefield']['rebuild']['count_rows'];

in body of function tablefield_field_is_empty($item, $field)
should be replaced with

  $count_rows = 0;
  if(isset($item['tablefield']['rebuild'])) {
    $count_rows = $item['tablefield']['rebuild']['count_rows'];
  } else {
    $count_rows = count($item['tablefield']['tabledata']);
  }
lolandese’s picture

Status: Active » Closed (cannot reproduce)
StatusFileSize
new664 bytes

Here is a patch with your suggested code change.

Can you please replace the issue title with something that describes the issue. Furthermore, please provide some steps to reproduce that issue in the dev version. I can't get to provoke the undefined error, so I am unable to test. See https://www.drupal.org/issue-queue/how-to.

lolandese’s picture

Status: Closed (cannot reproduce) » Postponed (maintainer needs more info)

Status correction.

mykola dolynskyi’s picture

Title: tablefield_field_is_empty » Field data from UI not saving as tablefield_field_is_empty() mistakenly returns TRUE
mykola dolynskyi’s picture

@lolandese
1. changed the title. OK this way?

2. try to

function mynode_form_alter($form, &$form_state) {
...
  unset($form['field_mytablefield'][LANGUAGE_NONE][0]['tablefield']['rebuild']);
...
}
liam morland’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.