SAVE AN NODE ,IT IS:

* Notice: Undefined offset: 0 在 tablefield_field_validate() (行 95 在 D:\webserver\www.COM\sites\default\modules\tablefield\tablefield.module).
* Notice: Undefined offset: 0 在 tablefield_field_validate() (行 95 在 D:\webserver\www.COM\sites\default\modules\tablefield\tablefield.module).
* Notice: Undefined index: array_parents 在 field_default_form_errors() (行 343 在 D:\webserver\www.COM\modules\field\field.form.inc).
* Recoverable fatal error: Argument 2 passed to drupal_array_get_nested_value() must be an array, null given, called in D:\webserver\www.COM\modules\field\field.form.inc on line 343 and defined 在 drupal_array_get_nested_value() (行 6253 在 D:\webserver\www.COM\includes\common.inc).

CommentFileSizeAuthor
#8 tableexample.PNG12.18 KBrinno.casca
#2 1113248-2.patch867 byteskevin hankens

Comments

rinno.casca’s picture

Version: 7.x-2.0-alpha5 » 7.x-2.0-beta3

I'm getting the same error on a local installation with drupal 7 for any node, please help.

Notice: Undefined offset: 0 in tablefield_field_validate() (line 99 of D:\xampp\xampp\htdocs\xampp\drupal\a\sites\all\modules\tablefield\tablefield.module).
Notice: Undefined index: array_parents in field_default_form_errors() (line 343 of D:\xampp\xampp\htdocs\xampp\drupal\a\modules\field\field.form.inc).
Recoverable fatal error: Argument 2 passed to drupal_array_get_nested_value() must be an array, null given, called in D:\xampp\xampp\htdocs\xampp\drupal\a\modules\field\field.form.inc on line 343 and defined in drupal_array_get_nested_value() (line 6253 of D:\xampp\xampp\htdocs\xampp\drupal\a\includes\common.inc).

kevin hankens’s picture

StatusFileSize
new867 bytes

Hey there. Thanks for the report. I haven't been able to replicate here, but I suspect this patch will help.

Also, can you tell me a little about your content type definition? e.g. is it a required field, unlimited value, etc.

Thx!

kevin hankens’s picture

Status: Active » Needs review
rinno.casca’s picture

I've tested your change and so far it works.
Field is required, limited value, 2 cols 30 rows.
If I could have 2 cols 30 rows set but have a "add one row" button to let users add one row, it would be great and inline with drupal unlimited standard for field types - just a suggestion.
Thank you.

rinno.casca’s picture

++Also appending any unused rows without rebuilding the table as this causes loss of all data entered into the table.

kevin hankens’s picture

Great, I'll commit that patch.

Regarding #5, I'm not sure I understand how to reproduce. Can you give me some more info?

Thx!

kevin hankens’s picture

Status: Needs review » Closed (fixed)

Committed to 7.x-2.0-beta4.

Thx!

rinno.casca’s picture

StatusFileSize
new12.18 KB

Regarding #5, "remove" not "append" and there is no loss of data - this was a problem on my side*
Please see attached png. My table, even though I've entered only 5 rows shows the other rows as blank, it would be great if it could automatically remove the unused rows, an alternative easier approach is to have a "trim" button that removes the unused rows using js.
I know I can rebuild the table with the only 5 rows and it works fine, but I can't think of a use case where showing empty rows is required.

rinno.casca’s picture

I got rid of the unused rows by adding this piece of code, this only removes them from display, leaves them in edit - temporary change, not appropriate for permanent.

++ line 644 in tablefield.module

//get rid of empty rows from display
foreach($variables['rows'] as $key=>$row){
	foreach($row as $set=>$value){
		if(strlen($value['data']) == 0){
			unset($variables['rows'][$key]);
		}
	}
}