cancel
Showing results for 
Search instead for 
Did you mean: 

Check a checkbox of a checkboxgroup programmatically

Former Member
0 Kudos

Hi!

How can I set a checkbox which is part of a checkboxgroup to 'Checked'?

I tried:

for (int i = 0; i < wdContext.nodeIt_Custom().size(); ++i) {

wdContext.nodeIt_Custom().isMultiSelected(i);

}

... but it doesn't work, unfortunately.

Would be great, if you could help me.

Thanks,

Timo

Accepted Solutions (1)

Accepted Solutions (1)

florian_speth
Explorer
0 Kudos

Hi Timo,

you need to bind the "checked"-Property of the Checkbox to a Context-Attribute of type boolean.

Then you can check, whether the box is checked (>true) or unchecked (>false)

for(int i=0; i<wdContext.nodeCheckboxes().size(); i++)
{
if (wdContext.nodeCheckboxes().getCheckBoxElementAt(i).getChecked())
{
  //Do anything
}
}

Hope this helps. Regards,

Florian

Former Member
0 Kudos

Hi Florian,

I'm not sure whether I understand you correctly. I'm working with a Checkboxgroup, there I only can bind the Text for the different checkboxes, but not if if they are checked.

When I want to find out if a checkbox is checked I do it the following:

for (int i = 0; i < wdContext.nodeIt_Sales_Org().size(); ++i) {

if (wdContext.nodeIt_Sales_Org().isMultiSelected(i)) {

// do something

}

}

Now, I want to do it the other way round, I want to set some checkboxes to 'checked'.

My problem with your answer is, of course I can create a 'Checked'-Element in my node, but there is no Checked-Property in a Checkboxgroup, so how should the Checkboxgroup know that I want to use this Checked-Element to define if a checkbox is checked or not?

Kind regards,

Timo

Former Member
0 Kudos

IWDNode.setSelected(i, true) sets the multi-selection of the i'th node element.

Armin

Former Member
0 Kudos

Hi Armin,

thanks a lot. It's again a good example of sitting in front the computer thinking about a solution but the possible easy solution don't come into my mind.

Bye,

Timo

Answers (0)