[BUGFIX] Fix not showing remaining characters count in IRRE element 26/52226/2
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 28 Mar 2017 21:11:22 +0000 (23:11 +0200)
committerBenni Mack <benni@typo3.org>
Tue, 28 Mar 2017 22:17:12 +0000 (00:17 +0200)
When opening a record that has a closed IRRE element, the remaining
characters count is not initialized at all. Reinitialize this correctly
now by filtering out the already processed counters.

Resolves: #80470
Releases: master
Change-Id: I1f0f675ea968e1959f610fbfbdf236d843c1fd11
Reviewed-on: https://review.typo3.org/52226
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js

index a31066f..d776cac 100644 (file)
@@ -590,7 +590,6 @@ define(['jquery',
         */
        FormEngine.initializeEvents = function() {
 
-               FormEngine.initializeRemainingCharacterViews();
                FormEngine.initializeSelectCheckboxes();
 
                $(document).on('click', '.t3js-btn-moveoption-top, .t3js-btn-moveoption-up, .t3js-btn-moveoption-down, .t3js-btn-moveoption-bottom, .t3js-btn-removeoption', function(evt) {
@@ -744,7 +743,7 @@ define(['jquery',
         */
        FormEngine.initializeRemainingCharacterViews = function() {
                // all fields with a "maxlength" attribute
-               var $maxlengthElements = $('[maxlength]').not('.t3js-datetimepicker');
+               var $maxlengthElements = $('[maxlength]').not('.t3js-datetimepicker').not('.t3js-charcounter-initialized');
                $maxlengthElements.on('focus', function(e) {
                        var $field = $(this),
                                $parent = $field.parents('.t3js-formengine-field-item:first'),
@@ -766,6 +765,7 @@ define(['jquery',
                        // change class and value
                        $parent.find('.t3js-charcounter span').removeClass().addClass(maxlengthProperties.labelClass).text(TYPO3.lang['FormEngine.remainingCharacters'].replace('{0}', maxlengthProperties.remainingCharacters))
                });
+               $maxlengthElements.addClass('t3js-charcounter-initialized');
                $(':password').on('focus', function() {
                        $(this).attr('type', 'text').select();
                }).on('blur', function() {
@@ -992,6 +992,7 @@ define(['jquery',
                FormEngine.initializeNullWithPlaceholderCheckboxes();
                FormEngine.initializeInputLinkToggle();
                FormEngine.initializeLocalizationStateSelector();
+               FormEngine.initializeRemainingCharacterViews();
        };
 
        /**