diff --git a/include/class.forms.php b/include/class.forms.php
index 81689a7261a7eeadebf76d6f163cc8f93a8ecc9a..1718d5a8a7bb2f0926384eca76b9c476e608670b 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -1933,11 +1933,13 @@ class ThreadEntryWidget extends Widget {
         if (!$config)
             $config = $this->field->getConfiguration();
 
-        return new FileUploadField(array(
+        $field = new FileUploadField(array(
             'id'=>'attach',
             'name'=>'attach:' . $this->field->get('id'),
             'configuration'=>$config)
         );
+        $field->setForm($this->field->getForm());
+        return $field;
     }
 }
 
diff --git a/tickets.php b/tickets.php
index 57b7ee0e8ec949c2d99a9ce8c63b2c11f9ba4bd6..5b15b0015870db4509d07bc3e7f8c7a3ea5b8a1f 100644
--- a/tickets.php
+++ b/tickets.php
@@ -79,7 +79,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
                     'userId' => $thisclient->getId(),
                     'poster' => (string) $thisclient->getName(),
                     'message' => $_POST['message']);
-            $vars['cannedattachments'] = $response_form->getField('attachments')->getClean();
+            $vars['cannedattachments'] = $attachments->getClean();
             if (isset($_POST['draft_id']))
                 $vars['draft_id'] = $_POST['draft_id'];
 
@@ -89,8 +89,8 @@ if($_POST && is_object($ticket) && $ticket->getId()):
                 // for this staff. Else clean all drafts for the ticket.
                 Draft::deleteForNamespace('ticket.client.' . $ticket->getId());
                 // Drop attachments
-                $response_form->getField('attachments')->reset();
-                $response_form->setSource(array());
+                $attachments->reset();
+                $tform->setSource(array());
             } else {
                 $errors['err']=__('Unable to post the message. Try again');
             }