2017-07-21 50 views
0

我創建了一個帶有複選框的觸摸UI對話框。我已經使用後的servlet後綴@TypeHint使返回的值是一個布爾值(true或false)觸摸UI對話框中的複選框不返回布爾值 - AEM 6.2

我的代碼 -

<enableTooltip 
jcr:primaryType="nt:unstructured" 
sling:resourceType="granite/ui/components/foundation/form/checkbox" 
name="./enableTooltip" 
text="Enable tooltip?" 
value="true"/> 

<enableTooltipType 
jcr:primaryType="nt:unstructured" 
sling:resourceType="granite/ui/components/foundation/form/hidden" 
name="./[email protected]" 
value="Boolean"/> 

現在,當我嘗試運行此悅目聲明 -

<p data-sly-test="${properties.enableTooltip}">This is test data</p> 

「這是測試數據」總是打印出來,與複選框是否被選中無關。 有什麼問題?

提前致謝!

回答

0

根據文檔https://docs.adobe.com/docs/en/aem/6-3/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/checkbox/index.html你所做的是正確的。你可以試試下面的示例,這個完美的工作對我來說在AEM 6.2:

對話框:

<myCheckbox 
          jcr:primaryType="nt:unstructured" 
          sling:resourceType="granite/ui/components/foundation/form/checkbox" 
          name="./selected" text="Show Checkbox Value" 
          uncheckedValue="false" 
          value="{Boolean}true"/> 

在HTML:

<h1 data-sly-test.selected="${properties.selected}" >${selected}</h1>