Hi All,
I have a JSP page which contains radio buttons and input field.
I want to toggle a specific radio button when the input field get focus.
In plain html it would look like this (this code works)
<html>
<body>
<script>
function toggleRadio1() {
document.getElementById("rb1").checked = true;
}
</script>
<form>
<input type="radio" name="group1" id="rb1" value="Milk">Milk
<input type="text" onfocus="toggleRadio1()"><br>
<input type="radio" name="group1" id="rb2" value="Butter" checked> Butter<br>
<input type="radio" name="group1" id="rb3" value="Cheese"> Cheese
</form>
</body>
<html>
for toggling htmlb radio button I wrote the following code:
<script>
function toggleRadio1() {
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
// 'rbGroup' is the radio button group name
var rb1 = eval(func("rbGroup" + htmlb_radiobuttonmodifier.substring(3,7) + "1"));
sapUrMapi_RadioButton_toggle(rb1.id,event);
}
</script>
// inputFld is the inputField name
inputFld.setClientEvent(com.sapportals.htmlb.enum.EventTrigger.ON_FOCUS("toggleRadio1()");
In htmlb, unlike html the selected radio button get the focus, what causes infinite loop (I put the focus on the input field, the radio button get checked but since it gets the focus when I return to the input field the focus event is fired again and I cannot type in it).
How do I solve it?
Thanks,
Omri