Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Incorrect component operation after the AEM version upgrade

aliaksandr_hvozdzeu
Level 3
Level 3

I ran into a specific issue in a component after upgrading from 6.3 to 6.5.6. The component has after which 1 of 3 options is selected, and depending on which value is selected, another field should be displayed. At 6.3 there are no problems with this, after the upgrade to 6.5 the field is no longer displayed. All this in the component dialog box. The component has not changed. I noticed that the style has "hide" and it should disappear, but it doesn't. We have AEM version 6.5.6. I installed 6.5 myself and tested it and the component works. Then I installed service pack 6.5.6 and the component stopped working. This is a problem in the service pack. But I don’t understand why. 

 

cq:dialog

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Box"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[app.site.campaign.email.box,app.site.campaign.email.dialog.paddingOptionsToggleable,app.site.campaign.email.dialog.scrollableTabs]">
<content
granite:class="cmp-box--editor"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<tabs
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<general
jcr:primaryType="nt:unstructured"
jcr:title="General"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"
margin="{Boolean}true">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<boxLayout
granite:class="cq-dialog-dropdown-showhide"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Box Layout"
name="./boxLayout"
text="Box Style">
<granite:data
jcr:primaryType="nt:unstructured"
cq-dialog-dropdown-showhide-tab=".list-option-listfrom-showhide-tab"
cq-dialog-dropdown-showhide-target=".boxlayout-list-option-listfrom-showhide-target"/>
<items jcr:primaryType="nt:unstructured">
<square
jcr:primaryType="nt:unstructured"
text="Square"
value="square"/>
<rectangle
jcr:primaryType="nt:unstructured"
text="Rectangle"
value="rectangle"/>
<flexibleHeight
jcr:primaryType="nt:unstructured"
text="Flex"
value="flex"/>
</items>
</boxLayout>
<hideOnView
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Hide Box"
name="./hideOnView">
<items jcr:primaryType="nt:unstructured">
<standard
jcr:primaryType="nt:unstructured"
text="Always visible"
value=""/>
<hideOnMobile
jcr:primaryType="nt:unstructured"
text="Hide on mobile"
value="mobile-hide"/>
<hideOnDesktop
jcr:primaryType="nt:unstructured"
text="Hide on desktop"
value="desktop-hide mobile-show"/>
</items>
</hideOnView>
<backgroundColor
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Background Color"
name="./backgroundColor">
<items jcr:primaryType="nt:unstructured">
<White
jcr:primaryType="nt:unstructured"
text="White"
value="#F8F8F8"/>
<Black
jcr:primaryType="nt:unstructured"
text="Black"
value="#191919"/>
<Transparent
jcr:primaryType="nt:unstructured"
text="Transparent"
value="#242424"/>
</items>
</backgroundColor>
<backgroundImage
granite:class="hide boxlayout-list-option-listfrom-showhide-target foundation-layout-util-vmargin"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<granite:data
jcr:primaryType="nt:unstructured"
showhidetargetclearfields="img:./backgroundImage"
showhidetargetvalue="square,rectangle"/>
<items jcr:primaryType="nt:unstructured">
<file
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fileupload"
allowUpload="{Boolean}false"
autoStart="{Boolean}false"
class="cq-droptarget"
fieldLabel="Background Image"
fileNameParameter="./bgFileName"
fileReferenceParameter="./bgFileReference"
mimeTypes="[image/gif,image/jpeg,image/png]"
multiple="{Boolean}false"
name="./backgroundImage"
title="Background Image"
uploadUrl="${suffix.path}"
useHTML5="{Boolean}true"/>
</items>
</backgroundImage>
<boxLink
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
name="./boxLink"
required="false"
fieldLabel="Hyperlink"
rootPath="/content"/>
<boxLinkSuffix
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/inputgroup"
fieldLabel="Hyperlink suffix"
renderReadOnly="{Boolean}true">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Hyperlink suffix"
name="./boxLinkSuffix"/>
<rightButton
class="coral-Button--square"
icon="coral-Icon--adobeCampaign"
init="acmetadatapicker"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/button"
targetinput="input[name='./boxLinkSuffix']"/>
</boxLinkSuffix>
</items>
</column>
</items>
</general>
</items>
</tabs>
</items>
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs"
type="nav"/>
</content>
</jcr:root>

 

js 

(function(document, $) {
'use strict';
// When dialog gets injected
$(document).on('foundation-contentloaded', function(e) {
$('.cmp-box--editor coral-select.cq-dialog-dropdown-showhide', e.target).each(function(i, element) {

// Show or hide touch UI Dialog components
var target = $(element).data('cqDialogDropdownShowhideTarget');

if (target) {
Coral.commons.ready(element, function(component) {
// If there is already an inital value make sure the according target element becomes visible
showHideTarget(component, target);

component.on('change', function() {
showHideTarget(component, target);
});
});
}

// Show or hide touch UI Dialog Tabs
var tab = $(element).data('cqDialogDropdownShowhideTab');
var displaySiteLogo = $(".cmp-box--editor coral-checkbox[name='./logo/displaySiteLogo']");

if (tab) {
Coral.commons.ready(element, function(component) {
// If there is already an inital value make sure the according tab element becomes visible
showHideTab(component, tab);

component.on('change', function() {
showHideTab(component, tab);
});
$(displaySiteLogo).change(function() {
showHideTab(component, tab);
});
});
}
});

$('.cmp-box--editor coral-Checkbox.cq-dialog-checkbox-showhide', e.target).each(function(i, element) {

// Show or hide touch UI Dialog components
var target = $(element).data('cqDialogDropdownShowhideTarget');
if (target) {
Coral.commons.ready(element, function(component) {
// If there is already an inital value make sure the according target element becomes visible
showHideTarget(component, target, $(component).attr("checked"));

component.on('change', function(chEve) {
showHideTarget(component, target, chEve.currentTarget.checked);
});
});
}

});

showHideTarget($('.cq-dialog-dropdown-showhide', e.target));
showHideTab($('.cq-dialog-dropdown-showhide', e.target));
});

/**
* Show or hide touch UI Dialog components based on the selection made in the dropdown/select.
*
* @Param {component} component - currently selected element.
* @Param {target} target - target elements.
*/
function showHideTarget(component, target, checkedVal) {
var value = component.value,
$component = $(component);
if ($component.hasClass("coral-Checkbox")) {
if (checkedVal)
value = $component.data("checkboxTarget");
}

$(target).each(function(i, targetObj) {
var targetValue = $(targetObj).data('showhidetargetvalue');
var array = targetValue.split(',');

$(targetObj).not('.hide').addClass('hide');
if ($.inArray(value, array) === -1) {
// Clear fields
var clearFields = $(targetObj).data('showhidetargetclearfields');

if (clearFields) {
showHideClearFields(clearFields);
}
} else {
$(targetObj).filter("[data-showhidetargetvalue='" + targetValue + "']").removeClass('hide');
}
});
}

/**
* Show or hide touch UI Dialog tabs based on the selection made in the dropdown/select.
*
* @Param {component} component - Currently selected element.
* @Param {tab} tab - Tab elements.
*/
function showHideTab(component, tab) {
var value = component.value;

$(tab).each(function(i, tabObj) {
var $tab = $(tabObj).parents('.coral-Panel');
var tabId = $tab.attr('aria-labelledby');
var tabHead = $('.cmp-box--editor coral-tabview').find('coral-tab#' + tabId);
var tabValue = $(tabObj).data('showhidetabvalue');

var showHideTabValueArray = tabValue.split(',');

$(tabHead).not('.hide').addClass('hide');
$(tabObj).not('.hide').addClass('hide');

// Check any target condition before show or hide tab
var showtab = true;
var customCondition = $(tabObj).data('customcondition');

if (customCondition) {
showtab = checkCustomCondition(value);
}

if ($.inArray(value, showHideTabValueArray) !== -1 && showtab) {
$(tabHead).removeClass('hide');
$(tabObj).filter("[data-showhidetabvalue='" + tabValue + "']").removeClass('hide');
} else {
// Clear fields
var clearFields = $(tabObj).data('showhidetabclearfields');

if (clearFields) {
showHideClearFields(clearFields);
}
}
});
}

/**
* Custom conditional checks.
*
* @Param {string} value - Currently selected element.
* @Returns {boolean} - Element condition true or false.
*/
function checkCustomCondition(value) {
var conditionResult = true;
var hideOverlayPosition;
var $chkDisplaySiteLogo = $(".cmp-box--editor coral-checkbox[name='./logo/displaySiteLogo']");
var $selBoxLayout = $(".cmp-box--editor input[name='./boxLayout']");
var $selLogoPosition = $(".cmp-box--editor input[name='./logo/position']");

switch (value) {
case 'square':
hideOverlayPosition = $chkDisplaySiteLogo.is('[checked]') && $selLogoPosition.attr('value') === 'leftMiddle';

if (hideOverlayPosition) {
showHideOverlaySelection(true);
} else {
showHideOverlaySelection(false);
}

conditionResult = !$chkDisplaySiteLogo.is('[checked]') || hideOverlayPosition;

break;

case 'leftMiddle':
hideOverlayPosition = $selBoxLayout.attr('value') === 'square' && $chkDisplaySiteeLogo.is('[checked]');

showHideOverlaySelection(hideOverlayPosition);

conditionResult = !$chkDisplaySiteLogo.is('[checked]') || hideOverlayPosition;

break;

case 'topLeft':
case 'topCenter':
case 'topRight':
showHideOverlaySelection(false);

conditionResult = $selBoxLayout.attr('value') === 'square' && !$chkDisplaySiteLogo.is('[checked]');

break;
}

return conditionResult;
}

/**
* Hide/Un-hide overlay position selection elements.
*
* @Param {boolean} hide - Hide or un-hide.
*/
function showHideOverlaySelection(hide) {
var $overlayPositionSelection = $(".cmp-box--editor coral-select[name='./overlay/overlayPosition']");

if (hide) {
var $hiddenInput = $overlayPositionSelection.find('input');

$overlayPositionSelection
.find('coral-selectlist-item')
.filter('[value!="bottomRight"]')
.not('.hide')
.addClass('hide');

$hiddenInput
.attr('name', './overlay/overlayPosition')
.attr('value', 'bottomRight');

$overlayPositionSelection.find('span.coral3-Select-label').text('Bottom Right');
} else {
$overlayPositionSelection.find('coral-selectlist-item').removeClass('hide');
}
}

/**
* Clear touch UI Dialog fields based on the selection made in the dropdown/select.
*
* @Param {Array} clearFields - Array of field type and field names in format {<fieldType>:<fieldName>}.
* Fields supported: checkbox, textfield, image (fileupload).
*/
function showHideClearFields(clearFields) {
var fieldsArray = [];

if (clearFields.indexOf(',') === -1) {
fieldsArray.push(clearFields);
} else {
fieldsArray = clearFields.split(',');
}

fieldsArray.forEach(function(field) {
if (field.indexOf(':') !== -1) {
var delimiter = field.lastIndexOf(':');
var inputType = field.substring(0, delimiter);
var inputName = field.substring(delimiter + 1);

if (inputType === 'checkbox') {
clearCheckBox(inputName);
} else if (inputType === 'textfield') {
clearTextField(inputName);
} else if (inputType === 'img') {
clearImage(inputName);
}
}
});
}

/**
* Uncheck checkbox.
*
* @Param {string} name - Checkbox input name.
*/
function clearCheckBox(name) {
$(".cmp-box--editor coral-checkbox[name='" + name + "']").removeAttr('checked');
}

/**
* Reset textfield to empty.
*
* @Param {string} name - Textfield input name.
*/
function clearTextField(name) {
$(".cmp-box--editor input[name='" + name + "']").attr('value', '');
}

/**
* Delete fileupload image.
*
* @Param {string} name - Image input name.
*/
function clearImage(name) {
var $imgInput = $(".cmp-box--editor input[name='" + name + "']"),
$imgInputParent = $imgInput.parents('.coral-FileUpload--dropSupport').parent(),
$imgFileName = $imgInputParent.find('input.cq-FileUpload-filename'),
$imgFileReference = $imgInputParent.find('input.cq-FileUpload-filereference'),
$imgFileDelete = $imgInputParent.find('input.cq-FileUpload-filedelete');

$imgInput.attr('value', '');

$imgInputParent.find('.cq-FileUpload-thumbnail-img').remove();

if ($imgFileName.length > 0) {
$imgFileName.attr('value', '');
$imgFileName.removeAttr('disabled');
}

if ($imgFileReference.length > 0) {
$imgFileReference.attr('value', '');
$imgFileReference.removeAttr('disabled');
}

if ($imgFileDelete.length > 0) {
$imgFileDelete.attr('value', 'true');
$imgFileDelete.removeAttr('disabled');
}
}

}(document, Granite.$));

 

 

 

 

EZafZ.png5rDJO.png

 Thanks a lot!

6.5 Experience Manager Upgrading
6 Replies
SureshDhulipudi
Community Advisor
Community Advisor

did you check the changes in coral ui js object getting

$(document).on("foundation-contentloaded", function() {

var newCoralObject = $(".coral-dialog coral-tablist coral-tab)

newCoralObject.showHide()

 

}

Sudheer_Sundalam1
Level 2
Level 2

Hi aliaksandr_hvozdzeu,

 

I was able to make your dialog show/hide fields based on the dropdown selection change by doing following two changes to JS.

 

1) Instead of listening to $(document).on('foundation-contentloaded', function(e), I have replaced it with 

$(document).on('dialog-data-ready', function(e) {

2) Instead of passing Granite jquery object (document, Granite.$));  I have passed regular jquery object

}(document, $));

 

Hope this helps in fixing your problem.

 

aliaksandr_hvozdzeu
Level 3
Level 3

I followed your advice, but it didn’t work. I still have this problem. Can you double-check my code please.

 

(function(document, $) {
    'use strict';
    // When dialog gets injected
    $(document).on('dialog-data-ready', function(e) {
        $('.cmp-box--editor coral-select.cq-dialog-dropdown-showhide', e.target).each(function(i, element) {

            // Show or hide touch UI Dialog components
            var target = $(element).data('cqDialogDropdownShowhideTarget');

            if (target) {
                Coral.commons.ready(element, function(component) {
                    // If there is already an inital value make sure the according target element becomes visible
                    showHideTarget(component, target);

                    component.on('change', function() {
                        showHideTarget(component, target);
                    });
                });
            }

            // Show or hide touch UI Dialog Tabs
            var tab = $(element).data('cqDialogDropdownShowhideTab');
            var displaySiteLogo = $(".cmp-box--editor coral-checkbox[name='./logo/displaySiteLogo']");

            if (tab) {
                Coral.commons.ready(element, function(component) {
                    // If there is already an inital value make sure the according tab element becomes visible
                    showHideTab(component, tab);

                    component.on('change', function() {
                        showHideTab(component, tab);
                    });
                    $(displaySiteLogo).change(function() {
                        showHideTab(component, tab);
                    });
                });
            }
        });

        $('.cmp-box--editor coral-Checkbox.cq-dialog-checkbox-showhide', e.target).each(function(i, element) {

            // Show or hide touch UI Dialog components
            var target = $(element).data('cqDialogDropdownShowhideTarget');
            if (target) {
                Coral.commons.ready(element, function(component) {
                    // If there is already an inital value make sure the according target element becomes visible
                    showHideTarget(component, target, $(component).attr("checked"));

                    component.on('change', function(chEve) {
                        showHideTarget(component, target, chEve.currentTarget.checked);
                    });
                });
            }

        });

        showHideTarget($('.cq-dialog-dropdown-showhide', e.target));
        showHideTab($('.cq-dialog-dropdown-showhide', e.target));
    });

    /**
     * Show or hide touch UI Dialog components based on the selection made in the dropdown/select.
     *
     * @Param {component} component - currently selected element.
     * @Param {target} target - target elements.
     */
    function showHideTarget(component, target, checkedVal) {
        var value      = component.value,
            $component = $(component);
        if ($component.hasClass("coral-Checkbox")) {
            if (checkedVal)
                value = $component.data("checkboxTarget");
        }

        $(target).each(function(i, targetObj) {
            var targetValue = $(targetObj).data('showhidetargetvalue');
            var array = targetValue.split(',');

            $(targetObj).not('.hide').addClass('hide');
            if ($.inArray(value, array) === -1) {
                // Clear fields
                var clearFields = $(targetObj).data('showhidetargetclearfields');

                if (clearFields) {
                    showHideClearFields(clearFields);
                }
            } else {
                $(targetObj).filter("[data-showhidetargetvalue='" + targetValue + "']").removeClass('hide');
            }
        });
    }

    /**
     * Show or hide touch UI Dialog tabs based on the selection made in the dropdown/select.
     *
     * @Param {component} component - Currently selected element.
     * @Param {tab} tab - Tab elements.
     */
    function showHideTab(component, tab) {
        var value = component.value;

        $(tab).each(function(i, tabObj) {
            var $tab = $(tabObj).parents('.coral-Panel');
            var tabId = $tab.attr('aria-labelledby');
            var tabHead = $('.cmp-box--editor coral-tabview').find('coral-tab#' + tabId);
            var tabValue = $(tabObj).data('showhidetabvalue');

            var showHideTabValueArray = tabValue.split(',');

            $(tabHead).not('.hide').addClass('hide');
            $(tabObj).not('.hide').addClass('hide');

            // Check any target condition before show or hide tab
            var showtab = true;
            var customCondition = $(tabObj).data('customcondition');

            if (customCondition) {
                showtab = checkCustomCondition(value);
            }

            if ($.inArray(value, showHideTabValueArray) !== -1 && showtab) {
                $(tabHead).removeClass('hide');
                $(tabObj).filter("[data-showhidetabvalue='" + tabValue + "']").removeClass('hide');
            } else {
                // Clear fields
                var clearFields = $(tabObj).data('showhidetabclearfields');

                if (clearFields) {
                    showHideClearFields(clearFields);
                }
            }
        });
    }

    /**
     * Custom conditional checks.
     *
     * @Param {string} value - Currently selected element.
     * @Returns {boolean} - Element condition true or false.
     */
    function checkCustomCondition(value) {
        var conditionResult = true;
        var hideOverlayPosition;
        var $chkDisplaySiteLogo = $(".cmp-box--editor coral-checkbox[name='./logo/displaySiteLogo']");
        var $selBoxLayout = $(".cmp-box--editor input[name='./boxLayout']");
        var $selLogoPosition = $(".cmp-box--editor input[name='./logo/position']");

        switch (value) {
            case 'square':
                hideOverlayPosition = $chkDisplaySiteLogo.is('[checked]') && $selLogoPosition.attr('value') === 'leftMiddle';

                if (hideOverlayPosition) {
                    showHideOverlaySelection(true);
                } else {
                    showHideOverlaySelection(false);
                }

                conditionResult = !$chkDisplaySiteLogo.is('[checked]') || hideOverlayPosition;

                break;

            case 'leftMiddle':
                hideOverlayPosition = $selBoxLayout.attr('value') === 'square' && $chkDisplaySiteLogo.is('[checked]');

                showHideOverlaySelection(hideOverlayPosition);

                conditionResult = !$chkDisplaySiteLogo.is('[checked]') || hideOverlayPosition;

                break;

            case 'topLeft':
            case 'topCenter':
            case 'topRight':
                showHideOverlaySelection(false);

                conditionResult = $selBoxLayout.attr('value') === 'square' && !$chkDisplaySiteLogo.is('[checked]');

                break;
        }

        return conditionResult;
    }

    /**
     * Hide/Un-hide overlay position selection elements.
     *
     * @Param {boolean} hide - Hide or un-hide.
     */
    function showHideOverlaySelection(hide) {
        var $overlayPositionSelection = $(".cmp-box--editor coral-select[name='./overlay/overlayPosition']");

        if (hide) {
            var $hiddenInput = $overlayPositionSelection.find('input');

            $overlayPositionSelection
                .find('coral-selectlist-item')
                .filter('[value!="bottomRight"]')
                .not('.hide')
                .addClass('hide');

            $hiddenInput
                .attr('name', './overlay/overlayPosition')
                .attr('value', 'bottomRight');

            $overlayPositionSelection.find('span.coral3-Select-label').text('Bottom Right');
        } else {
            $overlayPositionSelection.find('coral-selectlist-item').removeClass('hide');
        }
    }

    /**
     * Clear touch UI Dialog fields based on the selection made in the dropdown/select.
     *
     * @Param {Array} clearFields - Array of field type and field names in format {<fieldType>:<fieldName>}.
     *          Fields supported: checkbox, textfield, image (fileupload).
     */
    function showHideClearFields(clearFields) {
        var fieldsArray = [];

        if (clearFields.indexOf(',') === -1) {
            fieldsArray.push(clearFields);
        } else {
            fieldsArray = clearFields.split(',');
        }

        fieldsArray.forEach(function(field) {
            if (field.indexOf(':') !== -1) {
                var delimiter = field.lastIndexOf(':');
                var inputType = field.substring(0, delimiter);
                var inputName = field.substring(delimiter + 1);

                if (inputType === 'checkbox') {
                    clearCheckBox(inputName);
                } else if (inputType === 'textfield') {
                    clearTextField(inputName);
                } else if (inputType === 'img') {
                    clearImage(inputName);
                }
            }
        });
    }

    /**
     * Uncheck checkbox.
     *
     * @Param {string} name - Checkbox input name.
     */
    function clearCheckBox(name) {
        $(".cmp-box--editor coral-checkbox[name='" + name + "']").removeAttr('checked');
    }

    /**
     * Reset textfield to empty.
     *
     * @Param {string} name - Textfield input name.
     */
    function clearTextField(name) {
        $(".cmp-box--editor input[name='" + name + "']").attr('value', '');
    }

    /**
     * Delete fileupload image.
     *
     * @Param {string} name - Image input name.
     */
    function clearImage(name) {
        var $imgInput         = $(".cmp-box--editor input[name='" + name + "']"),
            $imgInputParent   = $imgInput.parents('.coral-FileUpload--dropSupport').parent(),
            $imgFileName      = $imgInputParent.find('input.cq-FileUpload-filename'),
            $imgFileReference = $imgInputParent.find('input.cq-FileUpload-filereference'),
            $imgFileDelete    = $imgInputParent.find('input.cq-FileUpload-filedelete');

        $imgInput.attr('value', '');

        $imgInputParent.find('.cq-FileUpload-thumbnail-img').remove();

        if ($imgFileName.length > 0) {
            $imgFileName.attr('value', '');
            $imgFileName.removeAttr('disabled');
        }

        if ($imgFileReference.length > 0) {
            $imgFileReference.attr('value', '');
            $imgFileReference.removeAttr('disabled');
        }

        if ($imgFileDelete.length > 0) {
            $imgFileDelete.attr('value', 'true');
            $imgFileDelete.removeAttr('disabled');
        }
    }

}(document, $));
Sudheer_Sundalam1
Level 2
Level 2

So while checking before proposing this solution, I saw that your dialog code is not being executed at all when you open the dialog. That's why I changed it to 'dialog-data-ready'. Try to add a simple console log statement right after the 'use strict' statement and deploy the code. On the page load, in the browser console, you should see the console statement. This confirms that your js code is available in authoring mode.

aliaksandr_hvozdzeu
Level 3
Level 3

Hello, I found an interesting point.

In SP 6.5.6 file by path /libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide/js/dropdownshowhide.js  was updated and have a new method:

    Coral.commons.ready(function () {

       showHideHandler($(".cq-dialog-dropdown-showhide", e.target));

    });

If I leave only showHideHandler($(".cq-dialog-dropdown-showhide", e.target)); my component works as expected. What could have caused this?