onFocus event for Radio button list controll

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Albanese

    onFocus event for Radio button list controll

    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="javas cript">

    function Setup(){
    document.getEle mentById('txtNa me').focus();
    }


    function ShowMe(html){
    showText.innerH TML = 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:RadioButto nList 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.')">Fema le</asp:ListItem>
    </asp:RadioButton List>
    </td>
    </tr>
    <tr>
    <td>
    <strong>Favorit e Color:</strong>
    </td>
    <td>
    <asp:DropDownLi st id="ddlColor"
    onfocus="ShowMe ('Pick a Color.')" runat="server">
    <asp:ListItem
    Value="Blue">Bl ue</asp:ListItem>
    <asp:ListItem
    Value="Green">G reen</asp:ListItem>
    <asp:ListItem
    Value="Red">Red </asp:ListItem>
    <asp:ListItem
    Value="Plaid">P laid</asp:ListItem>
    </asp:DropDownLis t>
    </td>
    </tr>
    <tr>
    <td id="showText" align="middle"
    bgcolor="whites moke" colspan="2" height="50">
    &nbsp;<stron g>- display
    explanatory text here -</strong></td>
    </tr>
    <tr>
    <td align="middle" colspan="2">
    &nbsp;<asp:Butt on id="cmdSubmit"
    runat="server" Text="Submit"></asp:Button>
    </td>
    </tr>
    </tbody>
    </table>
    <!-- Insert content here -->
    </form>
    </body>
    </html>

  • Peter Huang [MSFT]

    #2
    RE: onFocus event for Radio button list controll

    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


    and


    i0zBHA.2272%40t kmsftngp02&rnum =1&prev=/groups%3Fq%3DRa dioButtonList%2 BRender
    Contents%26hl%3 Dzh-CN%26lr%3D%26ie %3DUTF-8%26oe%3DUTF-8%26selm%3De6Bu ai0zBHA
    .2272%2540tkmsf tngp02%26rnum%3 D1

    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.

    --------------------[color=blue]
    >Content-Class: urn:content-classes:message
    >From: "Michael Albanese" <malbanese@ci.s tamford.ct.us>
    >Sender: "Michael Albanese" <malbanese@ci.s tamford.ct.us>
    >Subject: onFocus event for Radio button list controll
    >Date: Thu, 11 Sep 2003 06:53:58 -0700
    >Lines: 110
    >Message-ID: <058a01c3786c$2 639f740$a001280 a@phx.gbl>
    >MIME-Version: 1.0
    >Content-Type: text/plain;
    > charset="iso-8859-1"
    >Content-Transfer-Encoding: 7bit
    >X-Newsreader: Microsoft CDO for Windows 2000
    >Thread-Index: AcN4bCY5hgM5qMy eQJi1tmTUcrbYzg ==
    >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    >Newsgroups: microsoft.publi c.dotnet.genera l
    >Path: cpmsftngxa06.ph x.gbl
    >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:108151
    >NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
    >X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    >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="javas cript">
    >
    > function Setup(){
    > document.getEle mentById('txtNa me').focus();
    > }
    >
    >
    > function ShowMe(html){
    > showText.innerH TML = 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="ShowM e('Enter your name.')"
    >runat="server" ></asp:TextBox>
    > </td>
    > </tr>
    > <tr>
    > <td>
    > <strong>Gender: </strong>
    > </td>
    > <td>
    > <asp:RadioButto nList id="rdGender"
    >onfocus="ShowM e('Enter your Gender.')" runat="server"
    >RepeatDirectio n="Horizontal ">
    > <asp:ListItem Value="Male"
    >onfocus="ShowM e('Enter your Gender.')">Male </asp:ListItem>
    > <asp:ListItem Value="Female"
    >onfocus="ShowM e('Enter your
    >Gender.')">Fem ale</asp:ListItem>
    > </asp:RadioButton List>
    > </td>
    > </tr>
    > <tr>
    > <td>
    > <strong>Favorit e Color:</strong>
    > </td>
    > <td>
    > <asp:DropDownLi st id="ddlColor"
    >onfocus="ShowM e('Pick a Color.')" runat="server">
    > <asp:ListItem
    >Value="Blue">B lue</asp:ListItem>
    > <asp:ListItem
    >Value="Green"> Green</asp:ListItem>
    > <asp:ListItem
    >Value="Red">Re d</asp:ListItem>
    > <asp:ListItem
    >Value="Plaid"> Plaid</asp:ListItem>
    > </asp:DropDownLis t>
    > </td>
    > </tr>
    > <tr>
    > <td id="showText" align="middle"
    >bgcolor="white smoke" colspan="2" height="50">
    > &nbsp;<stron g>- display
    >explanatory text here -</strong></td>
    > </tr>
    > <tr>
    > <td align="middle" colspan="2">
    > &nbsp;<asp:Butt on id="cmdSubmit"
    >runat="serve r" Text="Submit"></asp:Button>
    > </td>
    > </tr>
    > </tbody>
    > </table>
    > <!-- Insert content here -->
    > </form>
    ></body>
    ></html>
    >
    >[/color]

    Comment

    Working...