Search This Blog

Wednesday, December 10, 2014

Radio button list validation using JQuery.

Radio button list validation using JQuery.


<asp:RadioButtonList ID="rbIsactive" CssClass="radioButtonList" RepeatDirection="Horizontal" runat="server" ValidationGroup="g">
<asp:ListItem Value="0">Active</asp:ListItem>
<asp:ListItem Value="1">In Active</asp:ListItem>

</asp:RadioButtonList>

if ($("[id$=<%=rbIsactive.ClientID%>]").find("input:checked").length < 1) {
            var RB1 = document.getElementById("<%=rbIsactive.ClientID%>");
            var radio = RB1.getElementsByTagName("input");
            for (var i = 0; i < radio.length; i++) {
                if (radio[i].checked) {
                    break;
                }
                else if (i == radio.length - 1) {
                    rvalue = false;
                    alerts = "Please Select Workflow Status";
                    radio[0].focus();
                }
            }

        }


This will help you validate radio button list

No comments:

Post a Comment

Restricting Custom People Picker to only one Sharepoint group programatically

Refer the following script files in your page,     <!-- For People Picker -->     <script type="text/javascript" src...