diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php
index bb71a4a7f086c2e0e80bd1248bd73a8d5f470033..4ef9cfacbc0f4b14ae3d732c64a47525876ab5e6 100644
--- a/extension/qfq/qfq/AbstractBuildForm.php
+++ b/extension/qfq/qfq/AbstractBuildForm.php
@@ -1676,7 +1676,7 @@ abstract class AbstractBuildForm {
         }
 
         // truncate if necessary
-        if ($value != '') {
+        if ($value != '' && $formElement['maxLength'] > 0) {
             $value = substr($value, 0, $formElement['maxLength']);
         }
 
diff --git a/extension/qfq/tests/phpunit/fixtures/Generic.sql b/extension/qfq/tests/phpunit/fixtures/Generic.sql
index a8d17684f0da13f73b95ef0bf0bca6c35ed11bc7..8e5dafc56e0ab37fda161d2677a6a8fcb4d8cea4 100644
--- a/extension/qfq/tests/phpunit/fixtures/Generic.sql
+++ b/extension/qfq/tests/phpunit/fixtures/Generic.sql
@@ -16,6 +16,7 @@ DROP TABLE IF EXISTS Note;
 CREATE TABLE Note (
   id    BIGINT           AUTO_INCREMENT PRIMARY KEY,
   gr_id INT(11) NOT NULL DEFAULT 0,
+  person_id BIGINT(20) DEFAULT NULL,
   value VARCHAR(128),
   t1    TEXT,
   t2    TEXT
@@ -25,3 +26,20 @@ INSERT INTO Note (gr_id, value, t1, t2) VALUES
   (1, 'First note - constants', 'Latest Information', 'Dear User\nt\n you\'re invited to to our Christmas party'),
   (2, 'Second note - some variables', 'Latest Information: {{party:C:all}}',
    'Dear {{Firstname:C:all}} {{Lastname:C:all}}\n\n you\'re invited to to our Christmas party');
+
+
+DROP TABLE IF EXISTS Address;
+CREATE TABLE Address (
+  id        BIGINT(20)                                              NOT NULL                                          AUTO_INCREMENT,
+  person_id BIGINT(20)                                              NOT NULL                                          DEFAULT 0,
+  street    VARCHAR(128)                                            NOT NULL                                          DEFAULT '',
+  city      VARCHAR(128)                                            NOT NULL                                          DEFAULT '',
+  country   ENUM('', 'Switzerland', 'Austria', 'France', 'Germany') NOT NULL                                          DEFAULT '',
+  PRIMARY KEY (`id`)
+);
+
+INSERT INTO Address (person_id, street, city) VALUES
+  (1, 'Side Street', 'Zurich'),
+  (1, 'Park Street', 'Zurich'),
+  (1, 'Winter Street', 'Zurich'),
+  (2, 'Summer Street', 'Zurich');