cancel
Showing results for 
Search instead for 
Did you mean: 

defaulting a radio button

Former Member
0 Kudos

dear webdynpro developers

i need to know how to set a radio button to be clicked as default when i open a view.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rohan,

1. set the keyToSelect =key forradiobutton

2. Bind a context of type string to the selectedKey property of the radiobuttons name selectedradiobutton.

3. Create actions for all the buttons and bind them to their respective buttons.

4. In implementation you can check which radio button is selected using

if(wdContext.currentContextElement().getSelectedRB().equals("key_1"));

There are the 3 preperties maily used in of radiobutton.

KeyToSelect: Unique key which will be identified while selection from a number of radiobutton.s

SelectedKey: This is used set to the key of the radiobutton that is currently selected.

OnSelect: An event that you want to fire when the radio button is selected.

Rest each button is having a different action so you can open the document you want just checking which RB is selected.

if u want more information about Radio button go to this

https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/clientserver/uielib/standard/

Regards,

P.Manivannan

Answers (1)

Answers (1)

Former Member
0 Kudos

hi manivanan,

yes what you are saying is to check wether it is clicked or not but i require the button to be set clicked when the view is opened for the first time.

for example i have 4 radio buttons where b is the default clicked

a b. c d

so when i open the view i can see that b is already selected

how do i code for this.

regards

Rohan

Former Member
0 Kudos

hi,

If you are using radiobuttongroupbykey, then its selectedKey property must be bounded to a attribute of simpleType.

In wdDoInit(), set this attribute to the key which you want to display as checked by default.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi,

Use this code

create 2 attributes

1.Radio_activity

2.Sel_Value

wdContext.currentContextElement().setRadio_activity("b");

wdContext.currentContextElement().setSel_value(wdContext.currentContextElement().getRadio_activity());

go to properties assign the value keytoSelect -


>SelValue

selectedKey--->RadioActivity

Regards,

P.Manivannan.

Former Member
0 Kudos

Hi manoj

Plz give step by step procedure.

Thanks & Regards

Hazrath

Former Member
0 Kudos

Dear Manoj

i created a simpetype of "People" with two values Male and Female.

I create one value attribute with the name "People".

When design time iam able to see the 3 radiobuttons.

at runtime i did not get any radiobutton.

i binded the selected key property with the People value attr.

Plz give me the sol