diff --git a/content/src/content/jcr_root/apps/core/wcm/components/page/v1/page/clientlibs/editor/js/brandSlugTuple.js b/content/src/content/jcr_root/apps/core/wcm/components/page/v1/page/clientlibs/editor/js/brandSlugTuple.js index ee9abeec64..339d1b288e 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/page/v1/page/clientlibs/editor/js/brandSlugTuple.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/page/v1/page/clientlibs/editor/js/brandSlugTuple.js @@ -30,13 +30,15 @@ var $brandSlugTextfield = $(brandSlugTextfieldSelector, $brandSlugSection); if ($brandSlugCheckbox.length > 0 && $brandSlugTextfield.length > 0) { - var inheritedValue = $brandSlugTextfield.data("inheritedValue"); - var specifiedValue = $brandSlugTextfield.data("specifiedValue"); - var textfieldFoundation = $brandSlugTextfield.adaptTo("foundation-field"); - var checkboxFoundation = $brandSlugCheckbox.adaptTo("foundation-field"); - changeTextFieldState(textfieldFoundation, checkboxFoundation.getValue() === "true", inheritedValue, specifiedValue); - $brandSlugCheckbox.on("change", function() { - changeTextFieldState(textfieldFoundation, this.checked, inheritedValue, specifiedValue); + $brandSlugCheckbox.on("coral-component:attached", function() { + var inheritedValue = $brandSlugTextfield.data("inheritedValue"); + var specifiedValue = $brandSlugTextfield.data("specifiedValue"); + var textfieldFoundation = $brandSlugTextfield.adaptTo("foundation-field"); + var checkboxFoundation = $brandSlugCheckbox.adaptTo("foundation-field"); + changeTextFieldState(textfieldFoundation, checkboxFoundation.getValue() === "true", inheritedValue, specifiedValue); + $brandSlugCheckbox.on("change", function() { + changeTextFieldState(textfieldFoundation, this.checked, inheritedValue, specifiedValue); + }); }); } }); diff --git a/content/src/content/jcr_root/apps/core/wcm/components/page/v3/page/clientlibs/editor/js/brandSlugTuple.js b/content/src/content/jcr_root/apps/core/wcm/components/page/v3/page/clientlibs/editor/js/brandSlugTuple.js index ee9abeec64..339d1b288e 100644 --- a/content/src/content/jcr_root/apps/core/wcm/components/page/v3/page/clientlibs/editor/js/brandSlugTuple.js +++ b/content/src/content/jcr_root/apps/core/wcm/components/page/v3/page/clientlibs/editor/js/brandSlugTuple.js @@ -30,13 +30,15 @@ var $brandSlugTextfield = $(brandSlugTextfieldSelector, $brandSlugSection); if ($brandSlugCheckbox.length > 0 && $brandSlugTextfield.length > 0) { - var inheritedValue = $brandSlugTextfield.data("inheritedValue"); - var specifiedValue = $brandSlugTextfield.data("specifiedValue"); - var textfieldFoundation = $brandSlugTextfield.adaptTo("foundation-field"); - var checkboxFoundation = $brandSlugCheckbox.adaptTo("foundation-field"); - changeTextFieldState(textfieldFoundation, checkboxFoundation.getValue() === "true", inheritedValue, specifiedValue); - $brandSlugCheckbox.on("change", function() { - changeTextFieldState(textfieldFoundation, this.checked, inheritedValue, specifiedValue); + $brandSlugCheckbox.on("coral-component:attached", function() { + var inheritedValue = $brandSlugTextfield.data("inheritedValue"); + var specifiedValue = $brandSlugTextfield.data("specifiedValue"); + var textfieldFoundation = $brandSlugTextfield.adaptTo("foundation-field"); + var checkboxFoundation = $brandSlugCheckbox.adaptTo("foundation-field"); + changeTextFieldState(textfieldFoundation, checkboxFoundation.getValue() === "true", inheritedValue, specifiedValue); + $brandSlugCheckbox.on("change", function() { + changeTextFieldState(textfieldFoundation, this.checked, inheritedValue, specifiedValue); + }); }); } });