如何验证文本框 [英] How to validate text box
本文介绍了如何验证文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何才能验证文本框,以便仅使用自定义验证器才能用日期格式mmddyyyy填充文本框,任何人都可以阻止我使用javascript
How can i validate a text box so that text box should be filled with the date format mmddyyyy only using a custom validator can any one halp me for doing itthe code using javascript
推荐答案
有些简单的事情无法解决??
Something simple as this can''t work???
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="regvDate" runat="server" ControlToValidate="txtDate"
ErrorMessage="Date format is not valid!" ValidationExpression="(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])(19|20)\d\d"></asp:RegularExpressionValidator>
干杯
Cheers
检查此
Hi ,
Check this
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" Mask="99/99/9999" MaskType="Date" TargetControlID="TextBox1" PromptCharacter="_"> </cc1:MaskedEditExtender>
<cc1:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender1" ControlToValidate="TextBox1" EmptyValueMessage="Date is required" InvalidValueMessage="Date is invalid" IsValidEmpty="False" TooltipMessage="Input a Date"></cc1:MaskedEditValidator>
最好的问候
M.Mitwalli
Best Regards
M.Mitwalli
我为我的一个应用程序完成了它.
I do it for one of my application..see it..i wish it will help you..customize it as your wish..
if (!validateInput(autoCompleteBox1.Text, @"^[0-9]\d{1}/[0-9]\d{1}/\d{4}
这篇关于如何验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文