Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- A Universal Script for Javascript Form Validation


Dabrowski - 6:17 pm on Sep 24, 2008 (gmt 0)


I would lean towards injecting the error message

ok, then I'll look for an element with a class of something like 'error-message' and if there isn't one I'll stick a span in, in the style of my code posted above.

Fotiman@example.com

Use an email address type! :-D

Why would you want to create your own Regex-like pattern matching language

Trust me, I wouldn't even attempt to attempt that! Nothing that advanced.

What I had in mind really was for simple things like reference numbers, there are so many I couldn't possibly code all of them individually, but a simple way of creating a customised field (using Foti's slight change), examples:

car reg no UK.......X123 WYZ or AB08 CDE......@*## @@@
bank sort code......12-34-56..................##-##-##
BT account ref......AB12349876................@@########
HMRC PAYE...........123PP09876543.............###PP########
NI number...........XX 12 34 56 Y.............@@ ## ## ## @

You see what I mean?

An escape character might be handy, I guess some ref numbers could have a # or something in them.


Thread source:: http://www.webmasterworld.com/javascript/3749043.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com