[BUGFIX] Deactivated textarea elements are not visualized
authorOliver Hader <oliver@typo3.org>
Tue, 20 Nov 2012 20:08:42 +0000 (21:08 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 20 Nov 2012 23:38:34 +0000 (00:38 +0100)
Deactivated textarea elements, fields that have a NULL value
stored in the database, are not visualized correctly when
loading the backend editing form. The status is currently set
using JavaScript and triggered by TBE_EDITOR.fieldSet().
However, textareas don't have a human readable clone and thus
fieldSet() is not called and thus no status is set.

This issue is fixed by directly rendering the status in the
FormEngine.

Change-Id: I2dded816853f452b25f6edf6e7d7f6dca1387739
Fixes: #43175
Releases: 6.0
Reviewed-on: http://review.typo3.org/16636
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/jsfunc.tbe_editor.js
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/templates/tceforms.html

index 2c6df0f..953d0e5 100644 (file)
@@ -618,17 +618,6 @@ var typo3form = {
                                document[TBE_EDITOR.formname][theField+"_hr"].value = evalFunc.outputObjValue(theFObj, theValue);
                                if (document[TBE_EDITOR.formname][theField+"_cb"])      document[TBE_EDITOR.formname][theField+"_cb"].checked = "on";
                        }
-
-                       var controlName = theField.replace(new RegExp('^' + TBE_EDITOR.prependFormFieldNames), 'control[active]');
-                       var controlFields = document[TBE_EDITOR.formname][controlName];
-
-                       if (controlFields) {
-                               for (i = 0; i < controlFields.length; i++) {
-                                       if (controlFields[i].type === 'checkbox' && !controlFields[i].checked) {
-                                               typo3form.fieldSetNull(theField, true);
-                                       }
-                               }
-                       }
                }
        },
        fieldGet: function(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off, checkSetValue) {
index e5204f2..17f9a4b 100644 (file)
@@ -1119,6 +1119,7 @@ class FormEngine {
                                                        'FIELD' => $field,
                                                        'TABLE' => $table,
                                                        'ITEM' => $item,
+                                                       'ITEM_DISABLED' => ($this->isNullValue($table, $field, $row, $PA) ? ' disabled' : ''),
                                                        'ITEM_NULLVALUE' => $this->renderNullValueWidget($table, $field, $row, $PA),
                                                );
                                                $out = $this->addUserTemplateMarkers($out, $table, $field, $row, $PA);
@@ -1131,6 +1132,7 @@ class FormEngine {
                                                        'ID' => $row['uid'],
                                                        'PAL_LINK_ICON' => $thePalIcon,
                                                        'FIELD' => $field,
+                                                       'ITEM_DISABLED' => ($this->isNullValue($table, $field, $row, $PA) ? ' disabled' : ''),
                                                        'ITEM_NULLVALUE' => $this->renderNullValueWidget($table, $field, $row, $PA),
                                                );
                                                $out = $this->addUserTemplateMarkers($out, $table, $field, $row, $PA);
@@ -5079,6 +5081,7 @@ function ' . $evalData . '(value) {
                                        '###CONTENT_NAME###' => $content['NAME'],
                                        '###CONTENT_ITEM###' => $content['ITEM'],
                                        '###CONTENT_ITEM_NULLVALUE###' => $content['ITEM_NULLVALUE'],
+                                       '###CONTENT_ITEM_DISABLED###' => $content['ITEM_DISABLED'],
                                        '###ATTRIBUTES_LABEL###' => $labelAttributes,
                                        '###ATTRIBUTES_FIELD###' => $fieldAttributes,
                                );
@@ -6397,4 +6400,4 @@ function ' . $evalData . '(value) {
 }
 
 
-?>
\ No newline at end of file
+?>
index 20f31ba..83cc4d9 100644 (file)
@@ -20,7 +20,7 @@
                        <img name="cm_###FIELD_TABLE###_###FIELD_ID###_###FIELD_FIELD###" src="clear.gif" class="t3-TCEforms-contentchangedImg" alt="" />
                        <img name="req_###FIELD_TABLE###_###FIELD_ID###_###FIELD_FIELD###" src="clear.gif" class="t3-TCEforms-reqImg" alt="" />
                        ###FIELD_ITEM_NULLVALUE###
-                       <div class="t3-form-field-item">
+                       <div class="t3-form-field-item###FIELD_ITEM_DISABLED###">
                                <div class="t3-form-field-disable"></div>
                                ###FIELD_ITEM###
                        </div>
@@ -40,7 +40,7 @@
                <img name="cm_###CONTENT_TABLE###_###CONTENT_ID###_###CONTENT_FIELD###" src="clear.gif" class="t3-form-palette-icon-contentchanged" alt="" />
                <img name="req_###CONTENT_TABLE###_###CONTENT_ID###_###CONTENT_FIELD###" src="clear.gif" class="t3-form-palette-icon-required" alt="" />
                ###CONTENT_ITEM_NULLVALUE###
-               <div class="t3-form-field-item">
+               <div class="t3-form-field-item###CONTENT_ITEM_DISABLED###">
                        <div class="t3-form-field-disable"></div>
                        ###CONTENT_ITEM###
                </div>