cancel
Showing results for 
Search instead for 
Did you mean: 

How to know CheckBoxGroup element checked or not

Former Member
0 Kudos

Hi Friends,

I am working on the webdynpro programming and now i got a problem in checkboxgroup.

I need to know whether a checkbox element in the checkboxgroup is checked or not.

Based on that i need to dispaly the text of that checkbox element.

I got the solution to display the text of the checkbox element.But i was unable to place the condition whether that particular checkbox element is checked or not.

Could you people look in to this problem and hope bright answer from you.

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Sandeep,

There is a <b>onToggle</b> event which you can catch. So you can set what function you want to create on the selection of the checkBox.

It returns a boolean value. Initial value is set to False. So if the checkbox is checked it returns true. you can check for this boolean value in a <i>if()</i>, function and perform whatever function you want to do here in this loop.

I hope this helps you.

Regards

Pravesh

PS: Kindly consider rewarding points if helpful and solved.

<i>Message was edited by: Pravesh Verma</i>

Former Member
0 Kudos

Hi Praveen,

Here in my program i have only one Action Event.I need to chech that check box element in that event only.

Answers (2)

Answers (2)

Former Member
0 Kudos

The selection of a CheckBoxGroup is the selection of the bound context node.

Take a look at the IWDNode API to determine the current selection of a context node.

https://media.sdn.sap.com/javadocs/NW04/SPS15/wd/com/sap/tc/webdynpro/progmodel/api/IWDNode.html

Especially look at the methods getLeadSelection() and isMultiSelected(index)

Armin

Former Member
0 Kudos

Hi Sandeep,

You can use this code to get all the checked element in CheckBoxGroup :

for(int i=0;i<wdContext.node<node name>().size();i++)

{

if(wdContext.node<node name>().().isSelected(i))

{

wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess(""+wdContext.node<node name>().().get<node name>().().ElementAt(i).get<attribute name>());

}

}

put this code in action or wdModifyView()

Regards,

Rajeev