cancel
Showing results for 
Search instead for 
Did you mean: 

cl_htmlb_manager=>get_data( )

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

Hi,

<b>'rbg_id'</b> is the variable holding the id and not the id itself.

Regards

Raja

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Craig,

the code is pretty much the same. However I am creating the radiobutton group object somewhere in the code of an tableview iterator:

current_rbuttongroup = cl_htmlb_radiobuttongroup=>factory( id = rowindex
                                    selection = '4' ).

It is then added to a <i>cl_bsp_bee_table</i> like this

beetable->add( element = me->current_rbuttongroup level = 1 ).
beetable->add( element = radiobutton level = 2 ).
p_replacement_bee = beetable.

Thus - I think - the ID parameter in the <i>get_data()</i> method in an event handler of a controller must be something like

  CONCATENATE me->component_id '_2' INTO rbg_id.

as described in my original posting. Only when I was playing around with different ID strings I found that regardless of the ID <i>get_data()</i> returned some radiobutton group object - just not the one I was looking for

Regards,

Sebastian

Former Member
0 Kudos

I see, you know there was a topic about this weeks back. Maybe not a radiobuttongroup but get the id of object created in an iterator from the controller.

You might try searching in here for that, it was weeks before TechEd to give you a starting point.

Former Member
0 Kudos

Hi,

You can look for the selection in FORM_FIELDS in DO_HANDLE_DATA event and set the model attirbute accordingly. Form_FIELDS Name value pair will have the id of radio button and you can Grab the value from it.

Hope this helps.

-Suresh

Former Member
0 Kudos

Hi Suresh,

This a way around my problem and it does help me; thanks for the hint. It doesn't really answer my question though and I'd still be interested to learn why <i>cl_htmlb_manager=get_data()</i> behaves this way and what I am doing wrong

Regards,

Sebastian

daniel_humberg
Contributor
0 Kudos

Hi Sebastian,

did you find the reason for the strange behaviour yet? I have a similar problem. i try to use "get_data()" for a BSP-extension that i wrote myself, but get_data does not return anything.

Former Member
0 Kudos

Hi Daniel,

sorry for my belated answer, I was on vacation for a while.

However, I didn't solve the problem back then and eventually went along with Suresh's proposal and used form fields instead. So the actual question is still open.

Regards,

Sebastian