onFocus event for Radio button list controll

  • Thread starter Thread starter Michael Albanese
  • Start date Start date
M

Michael Albanese

I am developing an application to handle my compay's OSHA
reporting requirements.

Some of the input criteria are technical and narowly
defined, so I was trying to prvide what i call "Context
Sensitive Help" by providing a short instructional message
based on which control has Focus.

Because of the way that a Radio Button List control is
rendered in the browser i can not attach an onFocus event
to the radion button input element the way i do to the
other controlls.

I could replace these with dropdown lists, but i would
rather not re-design the GUI as it has been stable for a
while now.

Below is a sample of the type of page i am working on and
a radio button list that will not play.

Any ideas would be greatly appreciated.

Michael Albanese

========================================
<%@ Page Language="VB" %>
<html>
<head>
<script language="javascript">

function Setup(){
document.getElementById('txtName').focus();
}


function ShowMe(html){
showText.innerHTML = html
}


</script>
</head>
<body onload="Setup()">
<form runat="server">
<table cellspacing="0" width="400" align="center"
border="1">
<tbody>
<tr>
<td>
<strong>Name:</strong>
</td>
<td>
<asp:TextBox id="txtName"
onfocus="ShowMe('Enter your name.')"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<strong>Gender:</strong>
</td>
<td>
<asp:RadioButtonList id="rdGender"
onfocus="ShowMe('Enter your Gender.')" runat="server"
RepeatDirection="Horizontal">
<asp:ListItem Value="Male"
onfocus="ShowMe('Enter your Gender.')">Male</asp:ListItem>
<asp:ListItem Value="Female"
onfocus="ShowMe('Enter your
Gender.')">Female</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td>
<strong>Favorite Color:</strong>
</td>
<td>
<asp:DropDownList id="ddlColor"
onfocus="ShowMe('Pick a Color.')" runat="server">
<asp:ListItem
Value="Blue">Blue</asp:ListItem>
<asp:ListItem
Value="Green">Green</asp:ListItem>
<asp:ListItem
Value="Red">Red</asp:ListItem>
<asp:ListItem
Value="Plaid">Plaid</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td id="showText" align="middle"
bgcolor="whitesmoke" colspan="2" height="50">
&nbsp;<strong>- display
explanatory text here -</strong></td>
</tr>
<tr>
<td align="middle" colspan="2">
&nbsp;<asp:Button id="cmdSubmit"
runat="server" Text="Submit"></asp:Button>
</td>
</tr>
</tbody>
</table>
<!-- Insert content here -->
</form>
</body>
</html>
 
Hi Michael,

There is known issue in the Radio Button List control.
Take a look at
BUG: Attributes Property of ListItem Only Works Within an HtmlSelect Control
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q309338

and

http://groups.google.com/groups?hl=zh-CN&lr=&ie=UTF-8&oe=UTF-8&threadm=e6Bua
i0zBHA.2272%40tkmsftngp02&rnum=1&prev=/groups%3Fq%3DRadioButtonList%2BRender
Contents%26hl%3Dzh-CN%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3De6Buai0zBHA
.2272%2540tkmsftngp02%26rnum%3D1

Did I answer your question?

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
 
Back
Top