cancel
Showing results for 
Search instead for 
Did you mean: 

Radio Button disable/enalbe

Former Member
0 Kudos

Hi Experts,

I made a radiobuttonbykey in my application and have 4 options.

I want to disable and enable the options according to selection made on a dropdown.

For example

if i choose option 1 from dropdown then 2 options of radiobutton become enable and rest disable

if i choose option 2 from dropdown then 3 options of radiobutton become enable and rest disable

and like that...

I am able to disable/enable the whole radiobutton but i want its options to be disabled or enabled.

Regards

Rajat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rajat,

I understand your problem is that using radiobuttonbykey UI element, you can set the enabled property on/off for the entire value set, and not for individual values.

Is it ok to use radiobutton UI element for your requirement? Or is it that you are using some domain fixed values or value table as the value set for the radiobuttonbykey?

Depending on this, you can select one of the two alternatives:

1) If its ok to use radiobutton UI element, then there can be four different radiobutton UI elements bound to the same context. At runtime, the context will hold the key specified for the selected radiobutton. And here you can bind the visible/enabled property of the four diff radio buttons to a boolean context and can change it as per your requirement.

2) Incase you need to use radiobuttonbykey UI element, then bind the context dynamically through coding to the radiobuttonbykey. OnSelect event of the dropdown, you can define an action wherein you update the value set of the context bound to the radiobuttonbykey.

Incase of queries please revert.

Regards,

Chitrali

Former Member
0 Kudos

thanks Chitrali

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

declare an attribute enable_1 and enable_2 of type wdy_boolen in context node.Then for radiobuttondrpbykey set the enable property for this attribute.(ie for all radio buttons)

get the value of drop down using

CALL METHOD lo_element->get_attribute

IMPORTING

name= 'DRP'

EXPORTING

value = 'drp_val'.

if drp_val = '1'.

lo_el_context->set_attribute(

EXPORTING

name = `enable_1`

value = 'X' ).

else if drp_val = '2'.

lo_el_context->set_attribute(

EXPORTING

name = `enable_2`

value = 'X' ).

endif.

Former Member
0 Kudos

Hi Rajat,

Each Radio button UI element has the property called "Enabled".

So if u have four radio button menas create four attributes with type ABAP_Boolean and Bind it to your respective Radio button propert "Enabled".

Now If the attribute valie is "X" menas it is enabled and No value menas it will disabled at the browser.

Based on your conditions, using Set attribute method set the value "X" to your attribute and Enable/diable your Radio Button.

Any doubts let me know.

Thanks.

Former Member
0 Kudos

Hi Viji,

There is only 1 UI element ie radiobuttonbykey having 4 options.

and i want to disable/enable these 4 options individually

when i am binding the enable property then the all the 4 options get binded.

Regards

Rajat

Former Member
0 Kudos

hi rajat.....

you can use individuval dropdown and enable and disable it.

---regards,

alex b justin