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;
}

Comments

soulfroys’s picture

Category: bug » feature
Priority: Normal » Major
Status: Active » Needs review
StatusFileSize
new490 bytes
new490 bytes
realityloop’s picture

Status: Needs review » Reviewed & tested by the community

Tested in D7, this needs to go in as it's currently reducing the field length from Webforms default.

quicksketch’s picture

Title: Field Title length can't be longer than 128 chars » Field Title length should match Webform limit (255 characters) instead of 128 limit
Category: feature » bug

Thanks 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.

quicksketch’s picture

Issue summary: View changes

First paragraph is not relevant to this issue

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Committed finally. It's clearly been a long time since I've reviewed this queue. :(

  • Commit 6212a33 on 7.x-1.x by quicksketch:
    Issue #1896334 by NullIsNot0: Field Title length should match Webform...

  • Commit a193f3c on 6.x-1.x by quicksketch:
    Issue #1896334 by NullIsNot0: Field Title length should match Webform...

Status: Fixed » Closed (fixed)

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

khurrami’s picture