Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Checking of Radiobutton Group selection

Hi,

I have a screen wherein i have 3 Radiobuttons wrapped in radiobutton group and 2 input fileds. Whenever i select 1st radiobutton on the screen then 1st imput field should be enabled and the other field should be disabled.

if i click second radiobutton then 2nd field should be enabled and first one should be disabled. if i click 3rd radiobutton then two of the fields should be enabled.

I have tried using onClick event for radiobuttongroup but ended up in Portal Runtime Exception. May be, i'm not using the event in a correct way ?. Should we use onClick event of RadiobuttonGroup or is there any other way to achieve the same ? . Would be happy if you can send code snippet for reference

Any ideas/help would be rewarded..

Jojo

Former Member
Former Member replied

HI,

Try this

<%@ taglib uri="tagLib" prefix="hbj" %>

<%@ page import = "com.sapportals.htmlb.enum.EventTrigger" %>

<%@ page import = "com.sapportals.htmlb.event.Event;"%>

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<script>

function process()

{

var funcName = htmlb_formid+"_getHtmlbElementId";

func = window[funcName];

var inputfield1 = eval(func("txtMaterialNumberFrom"));

if (!inputfield1.isEnabled) {

inputfield1.setEnabled(true);

}

}

function process1()

{

var funcName = htmlb_formid+"_getHtmlbElementId";

func = window[funcName];

var inputfield1 = eval(func("txtMaterialNumberFrom"));

if (inputfield1.isEnabled) {

inputfield1.setDisabled(true);

}

}

</script>

<hbj:inputField

id="txtMaterialNumberFrom"

type="string"

maxlength="100"

jsObjectNeeded="TRUE"/>

<hbj:radioButtonGroup

id="radioGroup"

columnCount="1"

selection="BOL">

<hbj:radioButton

id="BOLProducts"

text="BOL Products"

key="BOL"

tooltip="Search BOL products"

jsObjectNeeded="TRUE">

<% radioGroup.getRadioButtonForKey("BOL").setClientEvent(EventTrigger.ON_CLICK, "process()"); %>

</hbj:radioButton>

<hbj:radioButton

id="MOLProducts"

text="MOL Products"

key="MOL"

tooltip="Search MOL products"

jsObjectNeeded="TRUE">

<% radioGroup.getRadioButtonForKey("MOL").setClientEvent(EventTrigger.ON_CLICK, "process1()"); %>

</hbj:radioButton>

</hbj:radioButtonGroup>

</hbj:form>

</hbj:page>

</hbj:content>

if you click on MOL the inputfield will be disabled.

if you click on BOL the inputfield will be enabled.

Message was edited by: Kirupanand Venkatapathi

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question