[英]How to “grey-out” <h:selectBooleanCheckbox> without disable?
I have a checkbox: 我有一个复选框:
<h:selectBooleanCheckbox value="#{bean.checkboxValue}"/>
Based on a given scenario, I need to grey-out the box and prevent the user from modifying it. 根据给定的方案,我需要将框变灰并阻止用户对其进行修改。 I know disable will do this, but the issue is that disable prevents POST and I need to send the value to my bean whether or not the box is greyed-out.
我知道disable可以做到这一点,但是问题是disable阻止了POST,并且无论盒子是否为灰色,我都需要将该值发送到我的bean。
Is there a way to grey-out and prevent user input without disable? 有没有一种方法可以变灰并阻止用户输入而不会禁用?
may be you try this: 也许你试试这个:
1 - Put a styleClass="make-disabled" in your booleanCheckBox; 1-在您的booleanCheckBox中放置一个styleClass =“ make-disabled”; 2 - Use a jquery function to disabled only in view context :
2-仅在视图上下文中使用jquery函数禁用:
jQuery(document).ready(function(){
//disabled all checks with class make-disabled
$('input[type=checkbox].make-disabled').attr('disabled','disabled');
//configure before submit form to enabled all checks with class make-disabled to send do request
jQuery('#yourFormId').submit(function(){
$('input[type=checkbox].make-disabled').attr('disabled',false);
});});
Sorry my english. 对不起,我的英语。 I'm brazilian.
我是巴西人。 This example help you?
这个例子对你有帮助吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.