cancel
Showing results for 
Search instead for 
Did you mean: 

Radio button in webdynpro

narendar_naidu
Active Participant
0 Kudos

Hi All,

I want to display and toggle between two radio buttons, I have tried ways mentioned in few posts, but still could nt get it.

I hv attached the screen shot. In the wddoinit method of my view i have added code (attached the code also).

but still both my RB are displayed as selected. Also Please throw some light on what occassion we use group by index and group by key.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos
narendar_naidu
Active Participant
0 Kudos

Hi Ram,

I am still getting both selected.

can u guide me on Initialization method.

i created the radio buttons separately and not by group by.

regards,

ramakrishnappa
Active Contributor
0 Kudos

Hi Naren,

Please do not bind the property KEY_TO_SELECT to same attribute, it should be having different keys

Only bind the "Selected key" to same attribute

Please refer the below snap shots

Now, upon select event, the selected key will be filled,

ie. if you select radio button 1, the key 1 will be set to the attribute.

Hope this resolves your issue.

Regards,

Rama

narendar_naidu
Active Participant
0 Kudos

Hi Ram,

I am unable to achieve the functionality. i have binded as per ur suggestion above.

when i first time open the url, my first RB is selected and 2nd RB is not selected.

As in intialization.i hv coded.

DATA lo_el_context TYPE REF TO if_wd_context_element.
   DATA ls_context TYPE wd_this->element_context.
   DATA lv_rb1 TYPE wd_this->element_context-rb1.

* get element via lead selection
   lo_el_context = wd_context->get_element( ).

* @TODO handle not set lead selection
   IF lo_el_context IS INITIAL.
   ENDIF.

* @TODO fill attribute
  lv_rb1 = 1.

* set single attribute
   lo_el_context->set_attribute(
     name `RB1`
     value = lv_rb1 ).

* set single attribute
   lo_el_context->set_attribute(
     name `RB2`
     value = space ).


now in select event of first and second button i hv added like this.

for 1st button event

DATA lo_el_context TYPE REF TO if_wd_context_element.
   DATA ls_context TYPE wd_this->element_context.
   DATA lv_rb1 TYPE wd_this->element_context-rb1.

* get element via lead selection
   lo_el_context = wd_context->get_element( ).

* @TODO handle not set lead selection
   IF lo_el_context IS INITIAL.
   ENDIF.

* @TODO fill attribute
  lv_rb1 = 1.

* set single attribute
   lo_el_context->set_attribute(
     name `RB1`
     value = lv_rb1 ).

     lo_el_context->set_attribute(
     name `RB2`
     value = space ).


for 2nd button event

* @TODO fill attribute
  lv_rb1 = 2.

* set single attribute
   lo_el_context->set_attribute(
     name `RB1`
     value = space ).

     lo_el_context->set_attribute(
     name `RB2`
     value = lv_rb1 ).


my 2nd button is unable to select, i mean initialization is being triggered again i guess, so when i commented the initialization code, no default RB  is slected.please suggest


regards,



regards,

narendar_naidu
Active Participant
0 Kudos

Hi Ram,

Thank you i could achieve it.and thanks for all helpfull replies.

regards,

ramakrishnappa
Active Contributor
0 Kudos

You are welcome

Answers (1)

Answers (1)

Former Member
0 Kudos

those radios need to be bound to the same attribute in the selectedKey property.

narendar_naidu
Active Participant
0 Kudos

Hi,

Do i need to code anything , in initialization method for the view.

regards,