on 05-30-2007 2:45 PM
All,
I have created <b>Multiple</b> checkbox (Without checkbox Grp) at runtime using below code. I have question..
How can I read the value of all checkboxes?
IWDAttributeInfo Checked_att =
wdContext.nodeSkill().getNodeInfo().addAttribute(
"checked",
"ddic:com.sap.dictionary.boolean");
final int size = wdContext.nodeT_Req().size();
for (int i = 0; i < size; i++) {
IWDCheckBox chkbox =
(IWDCheckBox) view.createElement(
IWDCheckBox.class,
"checkbox" + i);
chkbox.bindChecked(Checked_att);
String chk_text =
wdContext.nodeT_Req().getT_ReqElementAt(i).getStext();
chkbox.setText(chk_text);
IWDTray cont = (IWDTray) view.getElement("tray");
cont.addChild(chkbox);
}
Thanks in advance..
BM
Bharathi,
First of all -- your code seems to have a bug. All check-boxes are bound to single attribute, hence all of them edit single value.
I bet you need something like this:
final int size = wdContext.nodeT_Req().size();
final IWDTray cont = (IWDTray) view.getElement("tray");
for (int i = 0; i < size; i++) {
final IWDAttributeInfo Checked_att = wdContext.nodeSkill().getNodeInfo()
.addAttribute("checked" + i, "ddic:com.sap.dictionary.boolean");
final IWDCheckBox chkbox = (IWDCheckBox)
view.createElement(IWDCheckBox.class, "checkbox" + i);
chkbox.bindChecked(Checked_att);
final String chk_text = wdContext.nodeT_Req().getT_ReqElementAt(i).getStext();
chkbox.setText(chk_text);
cont.addChild(chkbox);
}
To get value you should use:
final Boolean _isFirstChecked = wdContext.currentSkillElement().getAttributeValue("checked0");
final boolean isFirstChecked = _isFirstChecked == null ? false : _isFirstChecked.booleanValue();
Use "checked1", "checked2"... for rest attributes
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All,
Sorry to get back delayed..
Im trying to read the checkbox(which created dynamically) using below code, but getting an error:
"Type Mismatch :can not convert from obuject to bollean.
Here is the code
final Boolean _isFirstChecked = wdContext.currentSkillElement().getAttributeValue("checked0");
final boolean isFirstChecked = _isFirstChecked == null ? false : _isFirstChecked.booleanValue();
Can anyone tell me what is wrong? or is there anyother way to read the checkbox value..
Thanks..
BM
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.