cancel
Showing results for 
Search instead for 
Did you mean: 

Radiobutton: Change the 'checked' radiobutton -> Both are 'checked'!

Former Member
0 Kudos

Hi @all,

can somebody help me?

My Problem is the following:

On my BSP I have a group of two radiobutton (Yes and No).

In the layout the 'checked' button is depending of one field.

This field is filled in the Eventhandler 'OnInputProcessing'.

Two of my test-codings:

Layout-Coding

1. test:

<%

if zomopportline-zmynrisk eq ‘YES’.

%>

<htmlb:radioButtonGroup id = "zmynrisk"

columnCount = "2"

width = "90" >

<htmlb:radioButton id = "riskno"

text = "Risk No">

</htmlb:radioButton>

<htmlb:radioButton id = "riskyes"

text = "Risk Yes"

checked = "TRUE" >

</htmlb:radioButton>

</htmlb:radioButtonGroup>

<%

else.

%>

<htmlb:radioButtonGroup id = "zmynrisk"

columnCount = "2"

width = "90" >

<htmlb:radioButton id = "riskno"

text = "Risk No"

checked = "TRUE" >

</htmlb:radioButton>

<htmlb:radioButton id = "riskyes"

text = "Risk Yes" >

</htmlb:radioButton>

</htmlb:radioButtonGroup>

<%

endif.

%>

2. test:

<%

if zomopportline-zmynrisk eq ‘YES’.

%>

<htmlb:radioButtonGroup id = "zmynrisk"

columnCount = "2"

width = "90" >

<htmlb:radioButton id = "riskno"

text = "Risk No"

checked = "" >

</htmlb:radioButton>

<htmlb:radioButton id = "riskyes"

text = "Risk Yes"

checked = “TRUE” >

</htmlb:radioButton>

</htmlb:radioButtonGroup>

<%

else.

%>

<htmlb:radioButtonGroup id = "zmynrisk"

columnCount = "2"

width = "90" >

<htmlb:radioButton id = "riskno"

text = "Risk No"

checked = "TRUE" >

</htmlb:radioButton>

<htmlb:radioButton id = "riskyes"

text = "Risk Yes"

checked = “ ”>

</htmlb:radioButton>

</htmlb:radioButtonGroup>

<%

endif.

%>

By the first processing of the BSP, the marked radiobutton is 'NO'. That is correct.

After the processing of the Eventhandler 'OnInputProcessing' the same BSP is called again. Now the marked radiobutton is 'NO' and 'YES'.

Correct is just 'YES'.

Does anybody know about this problem.

Thanks for any advice or path for more information.

Kind Regards

Petra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

<htmlb:radioButtonGroup id = "zmynrisk"
               columnCount = "2"
                     width = "90" >

    <htmlb:radioButton id = "riskno"
                     text = "Risk No"
                  checked = "TRUE" >
    </htmlb:radioButton>

    <htmlb:radioButton id = "riskyes"
                     text = "Risk Yes"
                  checked = “ ”>
    </htmlb:radioButton>

</htmlb:radioButtonGroup>

Just for starters you should be saying checked = "FALSE" > you can't leave it as blank or you get a compile error.

However I would suggest you check out the BSP Application "SBSPEXT_HTMLB" under SE80 and look at the example page "RadioButtonGroup.bsp" it's a great example and I think after a little bit of looking you'll see the way to solve your problem.

Former Member
0 Kudos

Hi Craig,

thanks for your info.

One of my other test was:

<%

if zomopportline-zmynrisk eq ‘YES’.

%>

<htmlb:radioButtonGroup id = "zmynrisk"

columnCount = "2"

width = "90" >

<htmlb:radioButton id = "riskno"

text = "Risk No"

checked = "FALSE" >

</htmlb:radioButton>

<htmlb:radioButton id = "riskyes"

text = "Risk Yes"

checked = “TRUE” >

</htmlb:radioButton>

</htmlb:radioButtonGroup>

<%

else.

%>

<htmlb:radioButtonGroup id = "zmynrisk"

columnCount = "2"

width = "90" >

<htmlb:radioButton id = "riskno"

text = "Risk No"

checked = "TRUE" >

</htmlb:radioButton>

<htmlb:radioButton id = "riskyes"

text = "Risk Yes"

checked = “FALSE”>

</htmlb:radioButton>

</htmlb:radioButtonGroup>

<%

endif.

%>

And this test also got the same problem.

Kinds regards,

Petra

Former Member
0 Kudos

From that example I mentioned:

<u><b>BSP Page Attribute:</b></u>

myRisk TYPE STRING

<u><b>BSP Page Layout:</b></u>


<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = " ">
    <htmlb:form>

        <htmlb:radioButtonGroup id = "zmynrisk"
                   columnCount = "2"
                         width = "90"
                     selection = "<%= myRisk %>" >

            <htmlb:radioButton id = "riskno"
                             text = "Risk No"
                          onClick ="radioButton" />

            <htmlb:radioButton id = "riskyes"
                             text = "Risk Yes"
                          onClick ="radioButton" />
    
        </htmlb:radioButtonGroup>

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

<u><b>BSP Event OnInputProcessing:</b></u>


* event handler for checking and processing user input and
* for defining navigation

DATA: rbg TYPE REF TO CL_HTMLB_RADIOBUTTONGROUP.

rbg ?= CL_HTMLB_MANAGER=>GET_DATA( 
                  request = request 
                  id = 'zmynrisk' 
                  name = 'radioButtonGroup' ).

IF rbg IS NOT INITIAL.
  myRisk = rbg->selection.
ELSE.
  myRisk = ''.
ENDIF.

You should really take a look at that example as it will open up a whole lot of options for you.

Former Member
0 Kudos

Another question for you.


<%
if zomopportline-zmynrisk eq ‘YES’.
%>

Where's that coming from a DB field? Are you displaying a table of records? If so you shuld check these links out for how to use the tableView and a Iterator will make the handling of the checkbox and the general output so much easier.

<a href="https://answers.sap.com/people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help">BSP Trouble Shooting: Getting Help</a>

<a href="https://answers.sap.com/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator">BSP Programming: HTMLB TableView Iterator</a>

PS. for future reference when you want to show code you can use the command code goes here ... without the underline

Former Member
0 Kudos

Hi Craig,

Thanks for your help...

It works perfect.

Kind regards

Petra

Former Member
0 Kudos

Great to hear! Be sure to mark the message solved so other having similiar problems can find it easier.

What about my questions in the last post? About whether you are using a table or not?

former_member181879
Active Contributor
0 Kudos

Please read at least the last 10-20 appends in this forum to get a feeling of the mood. Specifically I would wish you to read the "Rules of Engagement". This is so that Craig gets the points deserved.

thanks, ++bcm

Answers (0)