Switch to full style
HTML,DHTML,Javascript,XML,CSS
Post a reply

Radio Button list validation ASP

Mon Feb 20, 2012 12:25 pm

Radio Button list ASP

i have a table and it's rows containing radio buttonlists.i want to validate that radio buttons items wether atleast one is checked or not.if atlest one item is not checked in that case if i click submit button the the valuse should not submit.below one is my table.pls tel me how to validate radio buttons using javas script.
Code:
<table style="width: 100%; padding-bottom: 10px;" cellpadding="0" cellspacing="0"
        border="0" summary="0" id="Radiotable" runat="server">
        <tr>
            <td style="width: 10px">
            </td>
            <td width="3%">
            </td>
            <td>
                <asp:Label ID="lblError" runat="server" Font-Names="segoe UI" Font-Size="12px" ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                1.
            </td>
            <td>
                <asp:Label ID="lblQuestion1" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Did the driver report on time to the Pick up point (+ - 5 Minutes)?"></asp:Label>&nbsp;<sup
                        style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues1" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
                <asp:RequiredFieldValidator ID="rfvQues1" runat="server" ControlToValidate="rdlQues1"
                    ErrorMessage="*"></asp:RequiredFieldValidator>               
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                2.
            </td>
            <td>
                <asp:Label ID="lblQuestion2" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Did you encounter traffic jam on your route?"></asp:Label>&nbsp;<sup style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues2" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                3.
            </td>
            <td>
                <asp:Label ID="lblQuestion3" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Did the driver over speed?"></asp:Label>&nbsp;<sup style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues3" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                4.
            </td>
            <td>
                <asp:Label ID="lblQuestion4" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Did he pick any of Non MindTree Mind on route?"></asp:Label>&nbsp;<sup style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues4" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                5.
            </td>
            <td>
                <asp:Label ID="lblQuestion5" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Did the driver demonstrate rude behavior?"></asp:Label>&nbsp;<sup style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues5" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                6.
            </td>
            <td>
                <asp:Label ID="lblQuestion6" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Was the driver under the influence of Alcohol?"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues6" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                7.
            </td>
            <td>
                <asp:Label ID="lblQuestion7" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Did he follow the traffic rules?"></asp:Label>&nbsp;<sup style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues7" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
                8.
            </td>
            <td>
                <asp:Label ID="lblQuestion8" runat="server" Font-Names="segoe UI" Font-Size="12px"
                    Text="Was Vehicle Clean?"></asp:Label>&nbsp;<sup style="color: Red">*</sup>
            </td>
        </tr>
        <tr>
            <td style="width: 10px">
            </td>
            <td align="center" width="3%">
            </td>
            <td>
                <asp:RadioButtonList ID="rdlQues8" runat="server" Font-Names="segoe UI" Font-Size="12px">
                    <asp:ListItem Value="Yes">Yes</asp:ListItem>
                    <asp:ListItem Value="No">No</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
    </table>


Thanks in advanced.



Post a reply
  Related Posts  to : Radio Button list validation ASP
 redirect page based on user selection radio button     -  
 Convert link and button to custom button with good style     -  
 JSF Radio Buttons Form     -  
 form-Radio-buttons-checkBoxs-actions-HTML-Tags     -  
 XML validation against DTD     -  
 DNS Validation     -  
 US Zip Code Validation     -  
 validation on number     -  
 What will be validation for Zip code ?     -  
 date validation in asp     -  

Topic Tags

ASP Validation