Dear All,
I tried lots of option for showing the value of button text on click checkbox for multi field. But still I am facing the same issue.
While I select the one checkbox then automatically second checkbox value is showing , as shown below.

Option-1
I changed my java script like below and still was not able to fix.
//For the Load purpose
$("coral-checkbox[name='./includebutton']").each(function() {
toogleDiv($(this));
});
//For the Click purpose
$("coral-checkbox[name='./includebutton']").on("click", function() {
toogleDiv($(this));
});
function toogleDiv(_this) {
var related_div = _this.next('div');
if ($(':checkbox', _this).is(":checked")) {
related_div.show();
} else {
related_div.hide();
}
}
The conntent.xml for dialog is below in Option-2
Option-2
I followed the steps mentioned in the below URL and no luck. I have pasted my content.xml for dialog and below JS file.
AEM 6 Touch UI Show/Hide Checkbox Component Extension - Extension to the standard checkbox component. It enables hiding/…
***************************** Content.xml for dialog*********************************************************
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/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="Hero Poster Marquee"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[trowecorp.landing.poster.carousel]"
width="900px">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<carousel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
fieldLabel="Carousel Slides">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container"
name="./NestedSlides">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<headerSize
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Header Size"
name="./headerSize">
<items jcr:primaryType="nt:unstructured">
<font32
jcr:primaryType="nt:unstructured"
text="Font Size-32,Line-height-46"
value="hero-title32"/>
<font45
jcr:primaryType="nt:unstructured"
defaultValue="true"
text="Font Size-45,Line-height-46"
value="hero-title45"/>
<font50
jcr:primaryType="nt:unstructured"
defaultValue="true"
text="Font Size-50,Line-height-60"
value="hero-title50"/>
</items>
</headerSize>
<header
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Section Header"
name="./title"
useFixedInlineToolbar="{Boolean}true">
<rtePlugins jcr:primaryType="nt:unstructured">
<format
jcr:primaryType="nt:unstructured"
features="*"/>
<justify
jcr:primaryType="nt:unstructured"
features="*"/>
<lists
jcr:primaryType="nt:unstructured"
features="*"/>
<paraformat
jcr:primaryType="nt:unstructured"
features="*"/>
<links
jcr:primaryType="nt:unstructured"
features="*"/>
<image
jcr:primaryType="nt:unstructured"
features="*"/>
<findreplace
jcr:primaryType="nt:unstructured"
features="*"/>
<subsuperscript
jcr:primaryType="nt:unstructured"
features="*"/>
<spellcheck
jcr:primaryType="nt:unstructured"
features="*"/>
<misctools
jcr:primaryType="nt:unstructured"
features="*">
<specialCharsConfig jcr:primaryType="nt:unstructured">
<chars jcr:primaryType="nt:unstructured">
<trademark
jcr:primaryType="nt:unstructured"
entity="&#8482; &nbsp;"/>
<copyright
jcr:primaryType="nt:unstructured"
entity="&#169; &nbsp;"/>
<registered
jcr:primaryType="nt:unstructured"
entity="&#174; &nbsp;"/>
<mdash
jcr:primaryType="nt:unstructured"
entity="&#151; &nbsp;"/>
<leftdoublequote
jcr:primaryType="nt:unstructured"
entity="&#8220; &nbsp;"/>
<rightdoublequote
jcr:primaryType="nt:unstructured"
entity="&#8221; &nbsp;"/>
<servicemark
jcr:primaryType="nt:unstructured"
entity="&#8480; &nbsp;"/>
</chars>
</specialCharsConfig>
</misctools>
<styles
jcr:primaryType="nt:unstructured"
features="*">
<styles jcr:primaryType="cq:WidgetCollection"/>
</styles>
</rtePlugins>
<uiSettings jcr:primaryType="nt:unstructured">
<cui jcr:primaryType="nt:unstructured">
<inline
jcr:primaryType="nt:unstructured"
toolbar="[format#bold,format#italic,format#underline,#justify,#lists,subsuperscript#subscript,subsuperscript#superscript,links#modifylink,links#unlink,links#anchor,#image,findreplace#find,findreplace#replace,spellcheck#checktext,misctools#specialchars,misctools#sourceedit,#styles,#paraformat]">
<popovers jcr:primaryType="nt:unstructured">
<justify
jcr:primaryType="nt:unstructured"
items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
ref="justify"/>
<lists
jcr:primaryType="nt:unstructured"
items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
ref="lists"/>
<paraformat
jcr:primaryType="nt:unstructured"
items="paraformat:getFormats:paraformat-pulldown"
ref="paraformat"/>
<styles
jcr:primaryType="nt:unstructured"
items="styles:getStyles:styles-pulldown"
ref="styles"/>
</popovers>
</inline>
</cui>
</uiSettings>
</header>
<backgroundimage
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathbrowser"
fieldLabel="Background Image"
name="./bgImage"
rootPath="/content/dam/trowecorp"/>
<toggle
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/checkbox"
class="showhide"
id="toggle"
name="./toggle"
showhide-target=".showhide-target"
text="Show/Hide Toggle"
value="true"/>
<someContainer
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container"
class="showhide-target"
showhide-target-value="true">
<items jcr:primaryType="nt:unstructured">
<someInput
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Some Input"
name="./someInput"/>
</items>
</someContainer>
</items>
</column>
</items>
</field>
</carousel>
</items>
</column>
</items>
</content>
</jcr:root>
and my java script for above dialog is below.
(function (document, $) {
"use strict";
// listen for dialog injection
$(document).on("foundation-contentloaded", function (e) {
$(".showhide").each(function () {
showHide($(this));
});
});
// listen for toggle change
$(document).on("change", ".showhide", function (e) {
showHide($(this));
});
// show/hide our target depending on toggle state
function showHide(el) {
var target = el.data("showhideTarget"),
value = el.prop("checked") ? el.val() : "";
// hide all targets by default
$(target).not(".hide").addClass("hide");
// show any targets with a matching target value
$(target).filter("[data-showhide-target-value=\"" + value + "\"]").removeClass("hide");
}
})(document, Granite.$);
Can you please help me on this. Thanks in advance.
I don't see the recommendations being implemented in the code. The issue is with this code: