Hi,

Thanks for the great work on this module.

I use the following settings for matrix field in a content type.

Widget type : Table with headers and multiple rows
Number of values : Unlimited
Empty cells : - (since I'm not able to add an empty selection in one of the select type drop down)
Hide empty cells: Checked

SCENARIO: When you create the node, there are a couple of empty rows with "add another item" button. You fill them and save it. When you edit the node the third empty row appears which is fine. Leave the third row empty and save it. Edit it the node again, you see the third and fourth empty rows. Leave them empty and save it.

Extra empty rows keep adding in every edit.

Can somebody help with this?

Thanks,
Phantom

Comments

phantomvish’s picture

I forgot to mention : the display of the field is fine. The empty rows (with "-" in the select widget column) are not displayed in the node.

Thanks,
Phantom

develcuy’s picture

subscribing

phantomvish’s picture

Am I the only one facing this issue? Any help would be appreciated.

Thanks
Phantom

cjeich’s picture

subscribing

phantomvish’s picture

I'm still facing the issue, any help would be appreciated

tonylegrone’s picture

I'm having the same problem.

tonylegrone’s picture

I've narrowed this problem down to the select field I'm using. Unfortunately, there is no empty option for select fields so there is always a value being saved on the extra row.

My plan is to either fix the CCK select field behavior or stop the matrix module from displaying an extra row until the user clicks "Add another item"

tonylegrone’s picture

Status: Active » Fixed

GOT IT!

It turns out that in a CCK select field, you can make the first option value <none>. I used "<none>|Please Choose".

This doesn't completely fix the problem though. In matrix.module you need to change line 335 to:
if (strlen(trim($val)) && $val !== '<none>') {

This fixes the extra validation needed to filter out the <none> value for select fields.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.