cancel
Showing results for 
Search instead for 
Did you mean: 

NEED CODE FOR RADIOBUTTON SELECTION

Former Member
0 Kudos

Hi,

I have a requirement that I need to display 5 Radiobuttons on output, when I select 1st Radiobutton it should show the message that "Button 1 is selected". like that if I select remaining Buttons they should display individually like 2,3,4,5 are selected.

I Need the coding and the steps from scratch to end.

Good answers are given excellent points.

Accepted Solutions (0)

Answers (3)

Answers (3)

pravesh_verma
Active Contributor
0 Kudos

Hi Manikandan,

First create a simple type in Dictionary. In the webDynpro structure go to [Dictionary -> Local Dictionary -> data Types -> Simple Types].

Create a simple type, with <b>Enumeration</b> from <i>Enumeration tab</i> values like 1,2,3,4,5 as per your requirement.

Now in create a attribute in context node (<i>Say: Selection</i>)and assign the type from the <b>Simple Type</b>. Select the package which you may have entered while creating the simple type and then finally bind this simple type with this attribute.

Now create a UI element [<b>RadioBUttonGroupByKey</b>], in the <b>SelectedKey</b> property of this UI element bind the attribute which you have now created.

Create a Action for this dropdown UI element. In this action you can write this code:


String selection = wdThis.wdGetContext().currentContextElement().getSelection();
	  if(selection.equalsIgnoreCase("1")){
	  wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Button 1 is selected");
	  }
	  else if(selection.equalsIgnoreCase("2")){
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Button 2 is selected");
	  }
..
..
..
	  else if(selection.equalsIgnoreCase("5")){
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Button 5 is selected");
	  }

I hope this will help you. For any further queries kindly revert back.

Regards

Pravesh

Former Member
0 Kudos

Hi,

A few suggestions:

1. Never use all capital letters in either your posts or subject line. Using capital letters translates to shouting in the online world.

2. Refrain from using words like these:

<i> Good answers are given excellent points.</i>

SDN is a totally voluntary community and you are not entitled to get an answer. Words like these do not better your chances.

I suggest you go through .

Let's all make SDN a better place.

Regards,

Satyajit.

Former Member
0 Kudos

WHO R U TO TELL ME

Former Member
0 Kudos

Hi,

Try this

Create Radiobutton Group by index And bind the value dynamically by

List radio = new ArrayList(); //define a List object

IPrivate<View>.I<Radio>node ele=wdContext.node<Radio>();

int num=1;

while(num<=5)

{

IPrivate<View>.I<Radio>Element ele=wdContext.create<Radio>Element();

ele.set<Param>(num);

radio.add(ele);

num++;

}

//add the list to radio node

wdContext.node<radio>().bind(radio);

you can receive the value of radio as

String radiovalue=wdContext.current<radio>Element().get<param>();

wdComponentAPI.getMessageManager().reportSuccess("Button"+ radiovalue + " is Selected");