From 46aec9c2df918ec0a84453b023fae418aaafc511 Mon Sep 17 00:00:00 2001
From: Sascha Grossenbacher <saschagros@gmail.com>
Date: Thu, 14 Apr 2011 11:22:24 +0200
Subject: [PATCH] Issue #464290 by Berdir: Fixed fixed recipients textfield maxlength.

---
 privatemsg.pages.inc |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/privatemsg.pages.inc b/privatemsg.pages.inc
index 616d367..058f93b 100644
--- a/privatemsg.pages.inc
+++ b/privatemsg.pages.inc
@@ -257,7 +257,9 @@ function privatemsg_new(&$form_state, $recipients = '', $subject = '') {
     '#weight'             => -10,
     '#size'               => 50,
     '#autocomplete_path'  => 'messages/autocomplete',
-    // Do not hardcode #maxlength, make it configurable by number of recipients, not their name length.
+    // Disable #maxlength, make it configurable by number of recipients, not
+    // their name length.
+    '#after_build'        => array('privatemsg_disable_maxlength'),
   );
   $form['subject'] = array(
     '#type'               => 'textfield',
@@ -282,6 +284,14 @@ function privatemsg_new(&$form_state, $recipients = '', $subject = '') {
 }
 
 /**
+ * Remove the maxlength attribute from a field.
+ */
+function privatemsg_disable_maxlength($element) {
+  unset($element['#maxlength']);
+  return $element;
+}
+
+/**
  * Form builder function; Write a reply to a thread.
  */
 function privatemsg_form_reply(&$form_state, $thread) {
-- 
1.7.4.1

