on 06-14-2005 9:23 PM
Hi, I am getting an Javascript error saying <b>"selectedRadioValue has no properties"</b> with the following code. When the user clicks the a radio button, there is an alert displaying the selected radio button text. I was wondering if anyone can see what is wrong in my short code below?
Thanks so much, Baggett
<b><%@ taglib uri="tagLib" prefix="hbj" %>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
function alertSelectedRadio(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var selectedRadioValue = eval(func(htmlb_radiobuttonmodifier+"TestRadioButton"));
var radiotext = selectedRadioValue.getText();
alert("*** The radio button you selected is = " + radiotext);
} </SCRIPT>
<hbj:content id="myContext" >
<hbj:page title="Initial Page">
<hbj:form id="myFormId">
<hbj:gridLayout width="50%" >
<hbj:gridLayoutCell rowIndex="1" columnIndex="1" style="">
<hbj:radioButtonGroup id="TestRadioGroup" columnCount="2" selection="rb_fem">
<hbj:radioButton id="TestRadioButton" text="female" key="rb_fem" tooltip="I am female" jsObjectNeeded="TRUE" disabled="false" />
<hbj:radioButton id="TestRadioButton" text="male" key="rb_male" tooltip="I am male" jsObjectNeeded="TRUE" disabled="false" />
</hbj:radioButtonGroup>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell rowIndex="1" columnIndex="2" style="">
<hbj:button id="button1" text="Get Radio Button Pressed" jsObjectNeeded="TRUE" onClientClick="alertSelectedRadio()" />
</hbj:gridLayoutCell>
</hbj:gridLayout>
</hbj:form>
</hbj:page>
</hbj:content></b>
Hi Baggett,
I found out there is a bug with SAP's code. The only way to get hold of radio button is by using the following code.
function alertSelectedRadio(){
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
//you have to specify the group name
var selectedRadioValue1 = eval(func("TestRadioGroup" + htmlb_radiobuttonmodifier.substring(3,7)+ "1"));
var selectedRadioValue2 = eval(func("TestRadioGroup" + htmlb_radiobuttonmodifier.substring(3,7)+ "2"));
alert(selectedRadioValue1.getValue());
alert(selectedRadioValue1.getChecked());
alert(selectedRadioValue2.getValue());
alert(selectedRadioValue2.getChecked());
}
Message was edited by: Prakash Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prakash, thanks for your response! It now works on my machine!
<b>1.)</b> Do you know a website that talks about SAP HTMB with Javascript interaction?
<b>2.)</b> Also, the bug here was that the line:
<b>var selectedRadioValue = eval(func(htmlb_radiobuttonmodifier+"TestRadioButton"));</b>is suppose to work?
Thanks so much again Prakash!
Baggett
1. I have learned mainly from PDK. I will tell you a trick. Open your iView in a new window via IE and click on "save as" to save all the content. The IE automatically saves all the content ( javascript, css .. etc in a folder) and what you will find is controls_ie5.js file which has all the javascript code that portal uses for htmlb control.
2. That line is suppose to work according to PDK but it doesn't.
Later
prakash
User | Count |
---|---|
82 | |
9 | |
9 | |
7 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.