I see that issue with maxlength property is resolved here: http://drupal.org/node/1816212, but I can't find anywhere where to set maxlength... Anyway as I understood correctly - there is some field where I can set maxlength for text field - it's not necessary - just set maxlength (in code) to database field limit which is 255 chars.
Previous paragraph is not relevant to this issue.
I am talking here about field Title (see attached screenshot) which can be only 128 chars long when I create it with Form Builder. I found that in "form_builder.properties.inc" function "form_builder_property_title_form" (line 72) $form['title'] has no property '#maxlength'. By studying Drupal form API I noticed that '#maxlength' default is 128. I think if you do not set it, it defaults to 128. I made a dirty module hack and added line '#maxlength' => 255 to $form['title'] array and I can set field title 255 chars long now.
Long story short:
change "form_builder.properties.inc" function:
/**
* Configuration form for the "title" property.
*/
function form_builder_property_title_form(&$form_state, $form_type, $element, $property) {
$form = array();
$form['title'] = array(
'#title' => t('Title'),
'#type' => 'textfield',
'#default_value' => $element['#title'],
'#required' => TRUE,
'#weight' => -10,
);
return $form;
}
to:
/**
* Configuration form for the "title" property.
*/
function form_builder_property_title_form(&$form_state, $form_type, $element, $property) {
$form = array();
$form['title'] = array(
'#title' => t('Title'),
'#type' => 'textfield',
'#default_value' => $element['#title'],
'#maxlength' => 255,
'#required' => TRUE,
'#weight' => -10,
);
return $form;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | increase-title-maxlength-D6-1896334-01.patch | 490 bytes | soulfroys |
| #1 | increase-title-maxlength-D7-1896334-01.patch | 490 bytes | soulfroys |
| form_builder_title.png | 19.38 KB | nullisnot0 |
Comments
Comment #1
soulfroysRelated issue: #241319: Increase webform_component.name to 255
Comment #2
realityloop commentedTested in D7, this needs to go in as it's currently reducing the field length from Webforms default.
Comment #3
quicksketchThanks guys, I'll put this in next time I'm committing patches. This issue may also be of interest: #342722: Creating longer labels for questions.
Comment #3.0
quicksketchFirst paragraph is not relevant to this issue
Comment #4
quicksketchCommitted finally. It's clearly been a long time since I've reviewed this queue. :(
Comment #8
khurrami commentedincrease-title-maxlength-D7-1896334-01.patchthis patched helped
Thanks