Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | webform_components_form_255.patch | 407 bytes | quicksketch |
p_db_component_name.patch | 1.9 KB | Morbus Iff | |
Comments
Comment #1
quicksketchNow 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.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
joshmillerUsing 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:
Tested using this 255 string, before this hook_form_alter() it was limited to 128, after it went through as 255 characters.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
EDIT: I recommend you remove the line-breaks before testing...
josh
Comment #4
quicksketchThis 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.
Comment #5
modiphier CreditAttribution: modiphier commentedHello,
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?
Thanks,
Paul
Comment #6
quicksketchNo, 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.
Comment #7
modiphier CreditAttribution: modiphier commentedOk, 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...
Comment #8
quicksketchI've committed this adjustment that permanently makes the change recommended in #3.