How I got to this error: I upgraded a site from D6 to D7, following standard upgrade paths CCK Content Migrate. CCK Content migrate by default converts the field to either a 1 or 0 and then only shows “1” for all the labels.

What happens: When I try to select “Use field label instead of the "On value" as label” in the Boolean’s field settings Drupal returns “Attempt to update field Inactive failed: A list field (field_name) with existing data cannot have its keys changed..” I am not however touching the keys, I simply just leave the values that are already in place alone.

What should happen: It is my understanding that as long as keys are left alone labels can be changed as much as you want. Ideally I would like to be able to give these fields which already have data, a label other than the On value of “1”.

Discussion: It seems to me that having a “field settings” group on the field “Edit” tab seems counterproductive considering that there is also a “Field Settings” that contains the *exact* same form and it being present on this form makes changes to non-data-integrity-violating-settings impossible (for someone who doesn't know where to look for these settings in the SQL to edit it manually).

System and Version Information: Latest release of Drupal 7.19, PHP 5.2.17, MySQL 5.5.23-55, Apache…

Any insight or help would be greatly appreciated!

Comments

rbrownell’s picture

I found a way of manually doing this in the database.

First you need a SQL editor that can edit BLOBs. I am using SQLyog Community Edition. This free local SQL client can be downloaded from http://code.google.com/p/sqlyog/

Next you must find the table called field_config_instance **Not to be confused with field_config**

Find the field you are looking to change and make sure it correlates with the content type as indicated bundle column.

In the blob look for "display_label";i:0;

Change the i:0 to i:1.

Clear your cache.

You're done! Wash, rinse, and repeat as necessary.

Troubleshooting: If it is still displaying as 1s in the node edit form, sometimes it helps to go back to one of the fields you are editing and just click on save without touching any other settings, yes you will still get the error but for some reason this worked for me.

Discussion: Though I found this work-around, this still does not address the issue for those who aren't technically inclined.

mikehues’s picture

I ran into the same problem and came to the same conclusion about an hour ago. I connected to the database from the command line so I could edit blobs, ran this query (change field name to suit your needs) and cleared the cache. That did the trick.

update `field_config_instance` set data = replace(data, 's:13:"display_label";i:0;', 's:13:"display_label";i:1;') WHERE field_name like 'field_veg%';

I agree. we shouldn't have to resort to manual database updates to resolve this. Would also be nice if content_migrate defaulted to displaying labels instead of 1's and 0's. Next stop, cck issue queue.

mikehues’s picture

I started an issue in the cck issue queue (#1913072: Single on/off checkbox labels lost when upgrading to D7 with content_migrate) and provided a patch that sets display_label=1 during migration of single on/off checkboxes. This does not resolve the issue posted above, but it will keep you from having to manually update the database.

mikehues’s picture

Issue summary: View changes

Minor grammar and rewording. Message left in tact.

caspervoogt’s picture

I just ran into this with a boolean field as well, on Drupal 7.44. Thank goodness booleans are now their own thing in D8.
I went with the mysql query approach - thanks to @mikehues, that worked.

Version: 7.19 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.