I'm currently working on a project created by someone else. I have a textfield called "city". Currently the maximum limit is 255 characters. I want to update the maximum character to be 100. Looking at the code, it looks like the field was created using the features module. When I try to update the field, I got the FieldUpdateForbiddenException. I understand this is because I have value in the database. Is there a way update the field even if there is value in there? If I can't modify the database, can I change textfield max length in the form to be 100?
Thanks!
The website doesn't have CCK, so I'm not sure how to modify these fields. I'm using Drupal 7.
What I did: 1. I upgraded registration_page.info to upgrade the version from 7.x-1.0 to 7.x-1.1 2. I changed the field max length to 100 in registration.features.field.info
When I tried to deploy, I got this error
[sshexec] WD php: FieldUpdateForbiddenException: field_sql_storage cannot [error]
[sshexec] change the schema for an existing field with data. in
[sshexec] field_sql_storage_field_update_forbid() (line 229 of
[sshexec] /var/lib/www.mine.com/deploys/site_20140515_140323/modules/field/modules/field_sql_storage/field_sql_storage.module).
[sshexec] Cannot modify header information - headers already sent by (output [warning]
[sshexec] started at
[sshexec] /var/lib/www.mine.com/deploys/site_20140515_140323/sites/default/drushrc.php:2)
[sshexec] bootstrap.inc:1212
[sshexec] FieldUpdateForbiddenException: field_sql_storage cannot change the schema for an existing field with data. in field_sql_storage_field_update_forbid()
This is what the code look like in registration.features.field.info
// Exported field: 'node-registration-page-field_city'.
$fields['node-registration_page-field_city'] = array(
'field_config' => array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_city',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => '0',
'module' => 'text',
'settings' => array(
'max_length' => '255',
),
'translatable' => '0',
'type' => 'text',
),
'field_instance' => array(
'bundle' => 'registration_page',
'default_value' => NULL,
'deleted' => '0',
'description' => 'Please enter your city',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 31,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_city',
'label' => 'City',
'required' => 0,
'settings' => array(
'text_processing' => '0',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'size' => '60',
),
'type' => 'text_textfield',
'weight' => '26',
),
),
);