Posted by Morbus Iff on April 1, 2008 at 1:32pm
| Project: | Webform |
| Version: | 6.x-3.12 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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.
| Attachment | Size |
|---|---|
| p_db_component_name.patch | 1.9 KB |
Comments
#1
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.
#2
Automatically closed -- issue fixed for two weeks with no activity.
#3
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:
<?phpfunction 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.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
EDIT: I recommend you remove the line-breaks before testing...
josh
#4
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.
#5
Hello,
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
#6
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.
#7
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...
#8
I've committed this adjustment that permanently makes the change recommended in #3.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.