Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
187 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>
question from:https://stackoverflow.com/questions/65856168/data-from-textbox-submitted-to-database-although-regular-expression-is-not-valid

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

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...