简体   繁体   English

Liferay Spring MVC Portlet Lexicon 1.0切换

[英]Liferay Spring MVC Portlet Lexicon 1.0 Toggles

I am trying to leverage the Lexicon library toggles within a Liferay Spring MVC Portlet. 我正在尝试利用Liferay Spring MVC Portlet中的Lexicon库切换 I am using the Spring command for their form tag. 我正在使用Spring命令作为表单标签。 Which get my POJO class boolean property. 哪个获得了我的POJO类的布尔属性。 I set this to true and "bind" the value to the input value tag but switch does not renders as "on". 我将其设置为true并将值“绑定”到输入值标签,但是开关不会呈现为“ on”。 JSP: JSP:

<label> 
            <input name="POJO boolean property" id="POJO boolean property" value="${POJO boolean property}" class="toggle-switch" type="checkbox"> 
             <span aria-hidden="true" class="toggle-switch-bar"> 
                <span class="toggle-switch-handle"> 
                  <span aria-hidden="true" class="icon-ok toggle-switch-icon toggle-switch-icon-on">
                  </span>
                <span aria-hidden="true" class="icon-remove toggle-switch-icon toggle-switch-icon-off">
                </span>
             </span></span> 
        </input>
    </label>

The value attribute for checkbox input does not determinate the checked status. 复选框输入的value属性不会确定检查状态。

You have to bind che checked attribute. 你有车绑定checked属性。

Example: <input name="POJO boolean property" id="POJO boolean property" value="1" class="toggle-switch" type="checkbox" ${POJO-boolean-property ? 'checked' : ''}> 示例: <input name="POJO boolean property" id="POJO boolean property" value="1" class="toggle-switch" type="checkbox" ${POJO-boolean-property ? 'checked' : ''}> <input name="POJO boolean property" id="POJO boolean property" value="1" class="toggle-switch" type="checkbox" ${POJO-boolean-property ? 'checked' : ''}>

Look the input checkbox guide here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox 在此处查看输入复选框指南: https : //developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM