简体   繁体   中英

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. 在此处输入图片说明

Why do you disable cfacebook, when it is not selected?

On line 5, cFaceBook is disabled when not selected. So removing line 5 will fix your problem. 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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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