Hi,
I have a checkbox on dialog, with
Xtype=selection
type=checkbox
name=./facebook.
so when i check the checkbox, i want the facebook icon to be displayed, and not display when unchecked.
this is my code
<div class="mbr-contacts__column col-sm-4" data-form-type="formoid">
<span>
<a href="https://www.facebook.com"><img src="/content/dam/demo/images/facebook_alt.png" alt="facebookapp"></a>
</span>
</div>
when i went through, i found that we need to add this additional scriplet: <%=properties.get("facebook",String[].class)%> , if it is true, where shoulf i add.
Solved! Go to Solution.
Hi Shreyas
Could you please elaborate on your question?
If my understanding is correct you are trying to add a facebook icon in your presentation HTML, when the user checks the checkbox in the dialog ?
If so, you can if properties.get("facebook") is returning the expected value and according to the result you can write an if condition to hide or show your
<a href="https://www.facebook.com"><img src="/content/dam/demo/images/facebook_alt.png" alt="facebookapp"></a>
Please confirm if you are writing the code in scriptlet/ JSTL/Sightly???
Thanks
Veena
Hi Shreyas
Could you please elaborate on your question?
If my understanding is correct you are trying to add a facebook icon in your presentation HTML, when the user checks the checkbox in the dialog ?
If so, you can if properties.get("facebook") is returning the expected value and according to the result you can write an if condition to hide or show your
<a href="https://www.facebook.com"><img src="/content/dam/demo/images/facebook_alt.png" alt="facebookapp"></a>
Please confirm if you are writing the code in scriptlet/ JSTL/Sightly???
Thanks
Veena
You need to write code in the component and read whether the field was clicked using
<%=properties.get("facebook",String[].class)%>
in the component's JSP or HTL. Then you can use code in the component to display the Facebook icon in the component.
Views
Replies
Total Likes
Hi Shreyas L,
It is just if condition
If you are using sightly/AEM6 simply write
<sly data-sly-test="${properties.facebook}"> <a href="https://www.facebook.com"><img src="/content/dam/demo/images/facebook_alt.png" alt="facebookapp"></a> </sly>
Agreeing with both of the approaches.
1. By Veena :-
Get the value of check box by "properties.get("facebook")" and using condition you can add the image.
Otherwise you can also change CSS to hide by "visibility: hidden".
2. If it is HTL (formerly knows as Sightly),
<sly data-sly-test="${properties.facebook}">
<a href="https://www.facebook.com"><img src="/content/dam/demo/images/facebook_alt.png" alt="facebookapp"></a>
</sly>
I hope this would help you.
Thanks and Regards
Kautuk Sahni
hi veena,
you are right i am trying to display facebook icon using the check box, it shouldnt display if un-checked.
I am writing my code in jsp.
so <data-sly-test> wouldnt work right?
Views
Replies
Total Likes
Hi Shreyas
Sorry for the late response. So it should be simple as explained by me, scott and kautuk. Hope you know how to handle if else condition in JSP.
And I would suggest you to move to JSTL or if using AEM 6+ , use sightly. Writing in scriplets anymore doesn't seem to be a good quality coding . Just a thought :)
Thanks
Veena
Views
Replies
Total Likes
Hi Veena,
Thanks for the response, I have implemenetd it.
Views
Replies
Total Likes
Hi Veena,
I created one checkbox as below in my dialog under the component.
text: Mrp
value: true
uncheckvalue: false
resourcetype: checkbox out of box comp
i made it to returning the values in content folder- jcr root as true and false, when tick and untick the checkbox.
Now i want the below solution,
Condition: I want to show/hide some content( for eg: mrp-rate) on the page, If i tick/untick my checkbox.
I need to add if condition using sightly. How to achieve this
Views
Replies
Total Likes
Hi! Did you find a soultion? I have the same issue?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies