Bug #56221

Can't remove static templates from selection in template module

Added by Jost Baron over 6 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2014-02-23
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

After including a static template to a template using the template module, it cannot be removed afterwards. Clicking the "remove" button produces this JS error (in FF 27.0.1):

ReferenceError: formEl is not defined

var formObj = formEl.get();

FormEngine.js (line 178)

TYPO3-Version is current master (945911006229524d55cb48f1f7de0898be9a7b7f).

Associated revisions

Revision 6711c14b (diff)
Added by Wouter Wolters over 6 years ago

[BUGFIX] Can't remove static templates from selection in template module

Add missing '$' in front of formEl

Resolves: #56221
Releases: 6.2
Change-Id: Ia9b3260eebd007a60a34c33ac357fa84c572c8ac
Reviewed-on: https://review.typo3.org/27820
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Jost Baron
Tested-by: Jost Baron

Revision 78213ca3 (diff)
Added by Nicole Cordes over 6 years ago

[BUGFIX] Follow up: Remove icon doesn't work

With patch 6711c14 the function setFormValueManipulate was corrected but
if called it returns an array instead of the first form element. This
patch makes sure that the first object is always returned.

Resolves: #56221
Releases: 6.2
Change-Id: I03445afcb15d9323cd899974ac1cf378945e4ecb
Reviewed-on: https://review.typo3.org/28010
Reviewed-by: Stefan Neufeind
Reviewed-by: Markus Klein
Tested-by: Markus Klein

History

#1 Updated by Philipp Gampe over 6 years ago

  • Status changed from New to Needs Feedback

I cannot reproduce this. Are you sure that you cleared your browser cache?

#2 Updated by Jost Baron over 6 years ago

Yes, and I've tried it again just now - same error. The code looks like this:

File: /typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

174: // legacy function, can be removed once this function is not in use anymore
175: setFormValueManipulate = function(fName, type, maxLength) {
176:     var $formEl = FormEngine.getFormElement(fName);
177:     if ($formEl.length > 0) {
178:        var formObj = formEl.get();
179:        var localArray_V = new Array();

I think the problem is a '$' missing in line 178.

#3 Updated by Gerrit Code Review over 6 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27820

#4 Updated by Wouter Wolters over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#5 Updated by Mathias Wasserthal over 6 years ago

I still can't remove static templates.
The above fix fails a few lines later.
$formEl.get() returns an array of length 1, so in line 183

var fObjSel = formObj[fName + '_list'];

fails.
Changing line 178 to $formEl.get()[0] seems to work

#6 Updated by Jost Baron over 6 years ago

Hi Mathias,

I can't reproduce the problem. It could be browser dependent, but according to the jQuery API ( http://api.jquery.com/get/#get2 ) you are right. Which browser do you use?

But it should be

var formObj = $formEl.get(0);
in line 178.

#7 Updated by Mathias Wasserthal over 6 years ago

Hi Jost,
Thanks for looking into it.

I've tried it with chrome 33 and FF 27.
A co-worker of mine had the same problem.

I also checked the jQuery Version used. It's 1.11.0.

We've t3jquery installed, but I don't think this should pose any problems.

Your solution is more educated for sure, I just needed a quick fix to keep on working without checking the jQuery API.

But using $formEl.get(0) is the better solution anyway, as it really gets what is needed: the first (and only) element.

#8 Updated by Gerrit Code Review over 6 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28010

#9 Updated by Gerrit Code Review over 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28010

#10 Updated by Gerrit Code Review over 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28010

#11 Updated by Nicole Cordes over 6 years ago

  • Status changed from Under Review to Resolved

#12 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF