Component Rendering through checkbox | Community
Skip to main content
Level 6
September 14, 2021
Solved

Component Rendering through checkbox

  • September 14, 2021
  • 1 reply
  • 982 views

I have One checkbox Enable data. Once checkbox is checked/true Component is visible whenever checkbox is unchecked/false then component disappear from screen. I want to keep the component visible to check the checkbox again. But it get hidden and I cant find to make it checked/true.

AEM 6.5

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @ronnie09 

 

Please use the below one:

<p data-sly-test="${wcmmode.edit}">Configure Component</p>
<sly data-sly-use.tab="com.core.models.TabModel" data-sly-use.template="/components/commons/templates.html">
<div data-sly-test.addInData="${tab.onoff}" data-bv-show="data" data-bv-Id="${tab.id}"></div>
</sly>

 

Thanks!

1 reply

Asutosh_Jena_
Community Advisor
Community Advisor
September 14, 2021

Hi @ronnie09 

 

We need to update the HTL markup of the component so that it will not be hidden. Can you please provide the markup that you are using here and we can add the condition?

 

Thanks!

Ronnie09Author
Level 6
September 14, 2021

Hi @asutosh_jena_ 

<sly data-sly-use.tab="com.core.models.TabModel"
data-sly-use.template="/components/commons/templates.html">

 

<sly data-sly-test.addInData="${tab.onoff}">
<div data-bv-show="data" data-bv-Id="${tab.id}"></div>
</sly>
<sly data-sly-test="${!addInData}"></sly>

 

The blue lines I am adding condition

Kishore_Kumar_
Level 9
September 14, 2021

Hi @ronnie09 ,

 

Try with this.

 

<div data-sly-test="${tab.onoff}" data-bv-show="data" data-bv-Id="${tab.id}"></div>