Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

javascript - Data from textbox submitted to database although regular expression is not valid in asp

i am trying to submit data from textboxes and using regular expressions to validate data like email and phone. when i click submit button data get submitted to database even the validation in not true.

<asp:Panel ID="Panel2" runat="server"
    <div>
         <asp:TextBox ID="TextBox4" runat="server" class="login-textbox2" placeholder="Email id" Font-Names="Cambria"  Font-Size="medium" required="" oninvalid="this.setCustomValidity('Please Provide Your Email-id')" oninput="this.setCustomValidity('')"></asp:TextBox>
         <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="*" Display="Dynamic" ForeColor="Red" ValidationExpression="w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*" ControlToValidate="TextBox4"></asp:RegularExpressionValidator>
     </div>
    <div>
        <asp:TextBox ID="TextBox5" runat="server"   class="login-textbox2" placeholder="********" Font-Names="Cambria" Font-Size="medium" required="" oninvalid="this.setCustomValidity('Please Input a Strong Password')" oninput="this.setCustomValidity('')"></asp:TextBox>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="*" ForeColor="Red" ControlToValidate="TextBox5" Display="Dynamic" ValidationExpression="(?-i)(?=^.{8,}$)((?!.*s)(?=.*[A-Z])(?=.*[a-z]))(?=(1)(?=.*d)|.*[^A-Za-z0-9])^.*$"></asp:RegularExpressionValidator>
     </div>
    <div>
        <asp:Button ID="Button2" type="submit" runat="server" Text="Get Started" class="loginbtn" OnClick="Button2_Click" />
    </div>                         
</asp:Panel>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...