cancel
Showing results for 
Search instead for 
Did you mean: 

CheckBoxGruop - SingleSelection

Former Member
0 Kudos

Hi,

i have implemented a checkBoxGroup. I thought that in a group only one value can be selected?

But in my Gruop every CheckBoxField can be selected. I want that only one field can checked and if an other get selected the first field is unselected and the new one is selected.

String[] values = {Value_1,Value_2,Value_3,...}; 
                
             for (int i = 0; i < values.length; i++) { 
                        IWDNodeElement elem = wdContext.nodeNodeName().createElement(); 
                        elem.setAttributeValue("attName", values<i>); 
                        
                        wdContext.nodeName().addElement(elem); 
                }

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

What you are looking for is called RadioButtonGroupBy{Index,Key}.

Armin

Former Member
0 Kudos

Thanks, thats works fine. But is it possible to change the appereans?

So that first the label an than the radionButton appears.

I haven't found an attribute for this

Former Member
0 Kudos

No you cannot change that via the Web Dynpro API.

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can use radioButtonGroup which is more appropriate for your scenario as Armin said.

But for your purpose here is the solution:

1. Create two global variables ie in others section of the implementation tab as:


public static int j = 0;
public static boolean flag = false; 

2. Create an action gor your CheckBoxGroup ie onToggle and implement it as:


if(flag){
   wdContext.nodeMonthsOfYear().setSelected(j, false);	
// Here MonthsOfYear is the node containing the attribute mapped to your checkBoxGroup texts property
   
} 

Thats it.

Hope this helps.

thanks & regards,

Manoj

Edited by: Manoj Kumar on Mar 20, 2008 4:07 PM

Former Member
0 Kudos

Sorry, but this is bad advice.

Armin

Former Member
0 Kudos

Hi Armin,

I know this is bad advice.

But just to correct my previous reply, i missed some points there. I went to edit that reply but it is showing i cant do that.

Hence, i am posting the same here. Just for sake of correctness.

For SAP User :

I missed the complete solution in my previous reply. Well offcourse you can ignore the solution as it is really not proper to use this solution for your purpose.

You can use radioButtonGroup which is more appropriate for your scenario as Armin said.

But for your purpose here is the solution:

1. Create two global variables ie in others section of the implementation tab as:


public static int j = 0;
public static boolean flag = false; 

2. Create an action gor your CheckBoxGroup ie onToggle and implement it as:


if(flag){
   wdContext.nodeMonthsOfYear().setSelected(j, false);	
// Here MonthsOfYear is the node containing the attribute mapped to your checkBoxGroup texts property
   
} 

3. In wdDoModify() write:

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

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

flag = true;

j = i;

break;

}

}

Thats it.

Hope this helps.

thanks & regards,

Manoj

Former Member
0 Kudos

Still bad advice Think about what "static" means.

Apart from that, why should he use such a crappy workaround if there is a UI element that exactly fulfils the requirement (1-from-n selection)?

Armin