Increase length 'label' column for components
roginald - July 17, 2007 - 21:20
| Project: | Webform |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
I want to increase the max length of the 'label' for any given webform component. I found that this is stored in the 'webform_component' table as 'name'. This column lists a default value of 128. So this is rather simple to alter. However I don't see in the module or include files where to go to change the max length in the code itself for this particular form element. I tried just changing the database default, emptying cache, then re-editing the form, but the html still displays a max length of 128 for this field. Any suggestions?

#1
So I found in the module file code where I needed to make the change (I hope). Please let me know if this will cause problems, or if there is a more appropriate way to make this change, rather than modyfing the module code.
I added this line:
'#maxlength' => '255',
following this at line 914:
'#title' => t("Label"),
This, along with altering the field definition in the webform_component table for the 'name' field seems to be working.
#2
Any updates on this? I ran into the same issue, and used the method that roginald suggested. I hate hacking the module and the schema, and would love a better way to handle this problem.
#3
Find this piece of code (approx. line 900 in v.1.7 of webform.module file):
$form['field']['name'] = array('#type' => 'textfield',
'#default_value' => $currfield['name'],
'#title' => t("Label"),
'#description' => t('This is used as a descriptive label when displaying this form element.'),
'#required' => TRUE,
'#weight' => -1,
);
and insert '#maxlength' => '512', to look like this:
$form['field']['name'] = array('#type' => 'textfield',
'#default_value' => $currfield['name'],
'#title' => t("Label"),
'#description' => t('This is used as a descriptive label when displaying this form element.'),
'#maxlength' => '512',
'#required' => TRUE,
'#weight' => -1,
);
#4
Automatically closed -- issue fixed for two weeks with no activity.
#5
For me longer labels would be very helpfull, as far as I use the labels for questions, which might be longer than 255 chars.
#6
I'd like to see both a Topic (currently the short label) and a full-length Question for each answer field.
#7
The label field has been removed entirely and the 'markup' component has been put in place instead. There is no limit on text length for the markup component.
LWVMD, your request should be made a separate issue.
#8
Oh I misread the issue. I though we were talking about the 'label' component. Not increasing the Label (or Name) column for all components. I'll make this a feature request.
#9
For anyone trying to address this issue in v2.x of webform, you have to make the change in webform_components.inc. Around line 229, you'll see:
$form['name'] = array('#type' => 'textfield',
Just like in the prior version, you add the following line to that array:
'#maxlength' => '512',
You also need to make the change in the database as noted above:
#10
I'm not really sure why this works for you. While extending the maxlength is definitely necessary, you should also have to update the database column to 255 since it's set to cap at 128 by default. I'd like to add this to webform, so any patches submitted that implement this and an upgrade hook for 2.x (both Drupal 5 and 6) will gladly be applied.
#11
I did have to update the database column. The column changed to a text field in the db (instead of varchar) since I needed a field larger than 255 for some of my questions.
If I can find some time to figure out how to put together the patch and upgrade hook, I would love to help.
#12
The label length has been increased to 255 in this patch: http://drupal.org/node/241319.