on 12-08-2008 7:46 AM
Hi All,
I am using a Checkbox group in my application.I have binded my checkboxvalue attribute to an simple type.The problem is at runtime I am unable to view the Texts that I have binded.I have given the cardinality for my node as 0-n and the selection as 0-n.If I give these properties I am unable to view anything.Kindly let me know what could me the problem.
Thankx,
Naaz.
Hi ,
No none of the checkboxes are selected by default.
This is the code I have written in the button action to get all the checkbox values that I have selected:
String selected = null;
IPrivateWDSampleView.ICheckBoxNode node=wdContext.nodeCheckBox();
int size=node.size();
for(int i=0;i<size;i++)
{
IPrivateWDSampleView.ICheckBoxElement element=node.getCheckBoxElementAt(i);
if(node.isSelected(i))
{
selected=element.getCheckBoxVals();
wdComponentAPI.getMessageManager().reportSuccess("This is the selected value"+selected);
}
}
I am having three checkboxes namely:one,two,three.If i select two and press on submit button I am getting the output as :
This is the selected value:One
This is the selected value:Two
instead of just I have to get This is the selected value:Two.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
U can use thsi code to select witch check box is selected
for(int i=0;i<wdContext.nodeSport().size();i++)
{
IPrivateEditView.ISportElement ele=wdContext.nodeSport().getSportElementAt(i);
IPrivateEditView.ISportNode node=wdContext.nodeSport();
if(node.isMultiSelected(i)==true)
{
String batch=ele.getSport();
wdComponentAPI.getMessageManager().reportSuccess(batch);
}
}
Reagrds,
Swathi
Hi Armin,
Ya now i got it thank you.
Thankx,
Naaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
I have used the same code but still I am not getting the correct output.This is the output I am getting if i select second dropdown.
Checkbox #0 is checked
Checkbox #1 is checked
whereas I have to get only Checkbox #1 is checked.
Thankx,
Naaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
It was showing really.I have written the same code that you have given to me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Come on. When you use this code, do you get the correct output or not?
for (int i = 0; i < wdContext.nodeCheckBoxNode().size(); ++i)
{
if ( wdContext.nodeCheckBoxNode().isMultiSelected(i) )
{
/* checkbox at index i is checked */
wdComponentAPI.getMessageManager().reportSuccess("Checkbox #" + i + " is checked");
}
}
Armin
Edited by: Armin Reichert on Dec 12, 2008 11:33 AM
Hi Armin,
Ya i tried Swathi's code it is working fine .The code which you have sent was showing the first checkbox value.
Thankx,
Naaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Thankx a lot Swathi my issue has been resolved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thankx a lot Swathi.You resolved my issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I am still getting the same output.I am unable 2 understand why.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swathi,
The code is working perfectly but when I am selecting any one of the checkbox I am getting the first checkbox by default.
I have given the cardinality as 0-n and selection as 0-n
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U cannot use a simple type for insertind the text to the checkbox.
So continue with the way suggested by swathi.
Thanks & Regards,
lokesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satya,
Thankx for the quick reply.Cant i get the values from the simple type instead of giving it manually.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No u cant use simple type for check box.
U can do this U can put this method in the wdInit() method.
public void wdDoInit()
{
//@@begin wdDoInit()
String arr[]={"Cricket","Football","Tennis","Reading",
"Yoga","Swimming","Hockey","Softball",
"Teaching","Singing","Cooking","Dancing"};
for(int i=0;i<arr.length;i++)
{
IPrivateEditView.ISportElement e=wdContext.nodeSport().createSportElement();
wdContext.nodeSport().addElement(e);
e.setSport(arr<i>);
}
//@@end
}
set that cardinality to 0..n and selection to 0..n.
Regards,
H.V.Swathi
hi,
in case of check boxes, it will not work with
a simple type
write code similar to this according to your requirement
if(firstTime){
String[] names = {"one","two","three"};
for(int i=0;i<names.length;i++){
IPrivateCheckView.IXElement nelem =wdContext.nodeX().createXElement();
wdContext.nodeX().addElement(nelem);
nelem.setName(names);
}
}
where X is a node ,
Name is attribute under node X
of type string
bind the texts property of the check box group to the Node X
Regards,
Satya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.