cancel
Showing results for 
Search instead for 
Did you mean: 

onClick on radioButtonGroup

Former Member
0 Kudos

Hello,

According to the HTMLB documenation, "onClick" is supported on radiobuttonGroup. However, when I use it, I get a runtime error: Attribute 'onClick' not found in tag library 'HTMLB' for the tag radioButtonGroup.

Any idea how to generate a server event (onClick) when user changes the selected item of a radioButtonGroup?

Thanks ...

-shovon-

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

We all know that SAP´s sample code is mostly trivial and not covering all facets. But in this case the implementation is easy. Why did you not post a code snippet? The only thing I can guess is that you do not properly handle the event in your DynPage.

I found this test code for RadioButtons in my archive. It is based on a AbstractPortalComponent but should give anybody a proof of how it works.

protected void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

RadioButtonGroup rbg = new RadioButtonGroup("radioGroup");

rbg.setColumnCount(2);

RadioButton r1 = rbg.addItem("rb_one", "one");

RadioButton r2 = rbg.addItem("rb_two", "two");

RadioButton r3 = rbg.addItem("rb_three", "three");

RadioButton r4 = rbg.addItem("rb_four", "four");

RadioButton r5 = rbg.addItem("rb_five", "five");

rbg.setSelection("rb_one");

rbg.setOnClick("rbgEvent");

TextView text = new TextView("status");

text.setTooltip("Radio button status");

text.setText("no event");

IPageContext iPageContext = PageContextFactory.createPageContext(request, response);

Event event = iPageContext.getCurrentEvent();

if (null != event && "rbgEvent".equalsIgnoreCase(event.getAction()))

{

System.out.println("event invoked");

RadioButtonClickEvent evt = (RadioButtonClickEvent) event;

String selectedRadio = evt.getKey();

rbg.setSelection(selectedRadio);

text.setText(selectedRadio);

}

Form sampleForm = iPageContext.createFormDocument("form");

sampleForm.addComponent(rbg);

sampleForm.addComponent(text);

iPageContext.render();

}

Former Member
0 Kudos

If you want to do in a JSP Page, Use the Control API

<hbj:radioButton

id="someId"

text="someText"

key="rb_1"

tooltip="Some Tool Tip"

disabled="false"

>

<%

someId.setOnClick("methodName");

%>

</hbj:radioButton>

Former Member
0 Kudos

Thanks. Your example was useful. I have, however, used JSP, and using inline scripting within JSP, I was able to solve the problem. Here is an example JSP I have now:

<hbj:radioButtonGroup id="REASON_FOR_REQUISITION"

columnCount="3" selection='<%= ISR.getValue("REASON_FOR_REQUISITION") %>'>

<%

REASON_FOR_REQUISITION.setOnClick("check");

%>

<hbj:radioButton id="D1"

key='New'

text='New'

tooltip='New'

disabled='<%= ISR.getDisabled("REASON_FOR_REQUISITION") %>'

encode="false"

/>

Thanks ....

-shovon-

Former Member
0 Kudos

Thanks. I used your idea on a radioButton group and was able to solve the problem.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Moshiul,

I am SAP Technical Consultant ,currently finished NetWeaver & Ent Portal 6.0 SP2 corporate training arranged by my company www.enteg.com

I guess u r a Bangaladeshi .Basically i am based in Bangalore ,hailed from Malda ,West Bengal ,India .

I would like to make friendship with u .

Hoping that u will respond at moni@enteg.com