Hello,
this is a question regarding the class <i>cl_htmlb_manager</i>. I'd like to get at (the value of) the selection attribute of a radiobutton group after some button has been clicked. I use code like this in the event handler of a controller
... CONCATENATE me->component_id '_2' INTO rbg_id. radiobuttongroup ?= cl_htmlb_manager=>get_data( request = me->request name = 'radioButtonGroup' id = rbg_id ). IF radiobuttongroup IS BOUND. selection = radiobuttongroup->selection. ... ENDIF.
Now, I am pretty sure the ID I am using is the ID of an existing radiobuttongroup object. The strange thing is <i>get_data( )</i> returns a radiobuttongroup object, but it is not the one I am expecting. Even if one uses some bogus ID that sure doesn't exist <i>get_data()</i> returns a (real, non-null) object?! That is <i>radiobuttongroup IS BOUND</i> is always true. So I have two main questions:
1) What could be the reason for <i>cl_htmlb_manager=>get_data()</i> behaving like this, i.e. why does it return an (apparently newly instantiated) object in case it doesn't find an object with the ID provided, what would be the use of this new object?
2) Is there any way to find out which (radionbutton group-) objects exist at some point in time? I'd like to check whether the ID I'm using is really correct.
Regards,
Sebastian
What does your <htmlb:radionButtonGroup look like on your Page layout?
I always use:
radiobuttongroup ?= cl_htmlb_manager=>get_data( request = me->request name = 'radioButtonGroup' id = 'myRadioGroup' ). IF radiobuttongroup IS NOT INITIAL. selection = radiobuttongroup->selection. ..... ENDIF.
I always give it the exact name of the radioButtonGroup that I defined on my Page Layout. I'll play around and try to see if I get the same thing you are seeing, perhaps you found a bug/feature type of thing. Maybe Brian will have some thoughts on it when he logs in.
Hi Sebestian,
After seeing your code what i found is ID should be inside single quotes ''.
radiobuttongroup ?= cl_htmlb_manager=>get_data(
request = me->request
name = 'radioButtonGroup'
id = rbg_id ).
IF radiobuttongroup IS BOUND.
selection = radiobuttongroup->selection.
...
ENDIF.
The code should be,
radiobuttongroup ?= cl_htmlb_manager=>get_data(
request = me->request
name = 'radioButtonGroup'
id = 'rbg_id' ).
IF radiobuttongroup IS NOT INITIAL.
selection = radiobuttongroup->selection.
...
ENDIF.
Did you try this. You will get the selected Radio button under your Radiobuttongroup 'rbg_id'.
Hope this helps
arun
Add a comment