Validating fields

J

John

Hi

I have an enquiry form webform with fields of types date. How and where can
I validate that users enter valid date fields? Also is there a way to
provide format mask in a date field?

Thanks

Regards
 
X

Xavier Pacheco

Hmmmm, you could use a CompareValidator or a RangeValidator. Then,
reject dates that are incorrect.

For complex regular expression, check out:

http://www.regexlib.com/

If the range is of no use to you you can do something like:

<asp:CompareValidator runat=server ControlToValidate="datetextbox"
Operator="DataTypeCheck" Type="Date" />

to validate the type.

I also found the following article useful:

http://www.codeproject.com/aspnet/datevalidator.asp#xx461021xx

--
Xavier Pacheco
Xapware Technologies Inc

manage your projects: www.xapware.com/ActiveFocus.htm
the blog: www.xavierpacheco.com/xlog
the book: www.amazon.com/exec/obidos/ASIN/0672324431//xavierpacheco-20
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top