简体   繁体   English

如何“灰白” <h:selectBooleanCheckbox> 没有禁用?

[英]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.

相关问题 是否可以“灰出” ah:selectBooleanCheckbox? - Is it possible to “grey-out” a h:selectBooleanCheckbox ? 如何禁用 <h:selectBooleanCheckbox> 按下 <a4j:commandButton> 在jsf中 - How disable a <h:selectBooleanCheckbox> pressing a <a4j:commandButton> in jsf 如何设置ah:selectBooleanCheckbox的边框样式? - How to style the border of a h:selectBooleanCheckbox? 如何使用JSF的h:selectBooleanCheckbox和h:dataTable来获取选中的复选框而不提交页面内容? - How to use JSF's h:selectBooleanCheckbox with h:dataTable to get selected checkboxes without submitting the page content? 禁用启用 <h:commandButton> 取消选择/选择 <h:selectBooleanCheckBox> - Disable/Enable <h:commandButton> on deselecting/selecting <h:selectBooleanCheckBox> JSF:如何绑定许多h:selectBooleanCheckbox? - JSF: How to bind many of h:selectBooleanCheckbox? 如何在ah:dataTable中的ah:dataTable中映射ah:selectBooleanCheckbox的值? - How to map the value of a h:selectBooleanCheckbox in a h:dataTable within a h:dataTable? 如何选择多个行 <h:dataTable> 同 <h:selectBooleanCheckbox> - How to select multiple rows of <h:dataTable> with <h:selectBooleanCheckbox> h:selectBooleanCheckbox valueChangeListener不起作用 - h:selectBooleanCheckbox valueChangeListener is not working h:selectBooleanCheckbox中缺少属性 - Missing attributes in h:selectBooleanCheckbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM