I had some trouble when inserting values from an exploded array into a multiple field. Everything looked fine but only the first item of the list was reflected in a ticked checkbox when editing the entity - on investigation in the DB, all the values after the first were added with a preceding space.

The string I was exploding was days of the week formatted like this:

monday, tuesday, wednesday, thursday...

I tried making the seperator value ", " (with a space), and it worked, but I felt that is not a good solution with maintainability in mind and is not likely to be robust.

In the end I came up with a patch which adds a checkbox to the action options, this trims whitespace from each array item.

Comments

mjcarter’s picture

mjcarter’s picture

Whoops, spotted a schoolboy error when looking at the .patch file after uploading, now unticking the box works... I made the new option enabled by default as I believe it is less likely to lead to confusing behaviour - if others disagree please let me know.

I also fixed the white-spacing to be consistent with that currently used in the file.

mjcarter’s picture

Status: Active » Needs review