Tuesday 30 June 2015

IFSC Code Validation using JavaScript in Asp.net

function AllowIFSC() {
            var ifsc = document.getElementById('<%=txtifsccode.ClientID%>').value;
            var reg = /[A-Z|a-z]{4}[0][a-zA-Z0-9]{6}$/;

            if (ifsc.match(reg)) {
                return true;
            }
            else {
                alert("You Entered Wrong IFSC Code \n\n ------ or------ \n\n IFSC code should be count 11 \n\n-> Starting 4 should be only alphabets[A-Z] \n\n-> Remaining 7 should be accepting only alphanumeric");
                document.getElementById("<%=txtifsccode.ClientID%>").focus();
                return false;
            }

        }

<asp:TextBox ID="txtifsccode" runat="server" onblur="return AllowIFSC();"  MaxLength="11" Width="200" Style='text-transform: uppercase'></asp:TextBox>
                                    

No comments:

Post a Comment