We have some essay and survey questions that are quite long - longer than the DB's enforced 128 characters. This patch changes the component name column to 255, mimicking similar core patterns such as node.title.


quicksketch’s picture

Status: Needs review » Fixed

Now that we have a Drupal 6 version, I switched the update naming convention to start with 5200 for Drupal 5 and 6200 for Drupal 6. I also increased the #maxlength property on the component form to take advantage of the increased size.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

joshmiller’s picture

Version: 5.x-2.x-dev » 6.x-3.9
Assigned: Morbus Iff » Unassigned
Status: Closed (fixed) » Active

Using the latest Webform module, the "webform_components_form" does not specify a #maxlength, so it defaults to 128.

Make a custom a module and put this php in it to fix:

function hook_form_alter(&$form, &$form_state, $form_id) {
	if ($form_id == "webform_components_form") { $form['add']['name']['#maxlength']=255; }

Tested using this 255 string, before this hook_form_alter() it was limited to 128, after it went through as 255 characters.


EDIT: I recommend you remove the line-breaks before testing...


quicksketch’s picture

This probably should have been a new issue rather than reopening a 3 year-old request... but in any case we can make this change in the main module rather than needing a form alter.

modiphier’s picture


I actually need more than 255 characters. I have to create some forms with very large questions. Is it as easy as going into myphpadmin and changing the structure of the following entry?

5 name varchar(255) latin1_swedish_ci Yes NULL Change Drop More

Can I just change varchar(255) to varchar(512) or change the type to text instead of varchar?

quicksketch’s picture

Can I just change varchar(255) to varchar(512) or change the type to text instead of varchar?

No, because Drupal will still enforce a limit when the user enters in the value into the forms. You'd need to form_alter the form similar to the suggestion in #3 in addition to changing the database.

modiphier’s picture

Ok, well what I did on my test server was I made the change in the database table changing name to varchar(512) then i went into the webform.component.inc and includes/webform.component.inc and changed both instances of name to 512 also. I was then able to enter a question with 372 characters. When I say question I mean some of the fields are First Name, Last Name, etc but then some are multi sentence questions and that was where I was having an issue.

I do not understand the form_alter as you mentioned but I will keep a mental note of my change so if the webform module has an update I will have to remember what I did to keep it right.

Let me know if what I did isn't really ok and I will change it but I needed a fast fix.

google says that mysql 5 varchar can go up to 65535 characters...

quicksketch’s picture

Version: 6.x-3.9 » 6.x-3.12
Status: Active » Fixed
407 bytes

I've committed this adjustment that permanently makes the change recommended in #3.

Status: Fixed » Closed (fixed)

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