简体   繁体   English

复选框是否必须在表格中显示是/否

[英]Checkbox have to display in the TABLE YES/NO if it's checked or not

I am trying to get YES or NO when i check the CheckBox. 当我选中复选框时,我试图获取是或否。 I have the code below: 我有下面的代码:

if(cfacebook.isSelected()==true) {
cfacebook.setEnabled(true);
Datos[6]="Yes";
} else { cfacebook.setEnabled(false);
Datos[6]="No";
}

When the CheckBox is checked all is ok the Yes is displayed, and the same when it's unchecked but the Checkbox is now disable and i cannot create a new line. 当CheckBox选中时,一切正常,将显示Yes,而未选中时则显示相同,但​​Checkbox现在被禁用,我无法创建新行。 在此处输入图片说明

Why do you disable cfacebook, when it is not selected? 为什么未选择cfacebook时禁用它?

On line 5, cFaceBook is disabled when not selected. 在第5行上,未选中cFaceBook时被禁用。 So removing line 5 will fix your problem. 因此, 删除第5行将解决您的问题。 With this update, you do not need to enable it again on line 2.(really you do not need it because if it is selectable, already it is enabled) 使用此更新,您无需在第2行再次启用它(确实不需要它,因为如果它是可选的,则已经启用)

1 if(cfacebook.isSelected()==true) {
2    cfacebook.setEnabled(true);
3    Datos[6]="Yes";
4 } else { 
5    cfacebook.setEnabled(false);
6    Datos[6]="No";
7 }

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

相关问题 XSL复选框显示检查数据库中的值是否为1 - XSL checkbox display checked if value is 1 from database 设置面板以在选中CheckBox时显示? (JAVA) - Set Panel to display when CheckBox is checked? (Java) 从表中的复选框获取选中的行 - Getting checked rows from Checkbox in Table 将复选框的“已检查”从JSO传递到另一个 - Passing a checkbox's “checked” from a JSO to another 如果选中了复选框,则需要显示一些edittext字段,否则不显示它 - need to display some edittext fields if user is checked on checkbox otherwise not to display it 在显示确认对话框 Wicket 之前检查是否有一个选中的复选框 - Check there is one checked checkbox before display confirm dialog Wicket jtable复选框选中的行单击按钮时从表中删除? - jtable checkbox checked row remove from table when click button? 如何处理弹簧标签 <form:checkbox> 如果没有检查? - How to handle spring tag's <form:checkbox> if it is not checked? 尽管已选中JTable中的Checkbox始终返回false - Checkbox in JTable always return false despite of it's checked 在列表视图中处理选中然后未选中的复选框的值 - Handle checked and then unchecked checkbox's value in listview android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM