calling all JavaScript masters

by "Greg Rundlett" <greg(at)freephile.com>

 Date:  Mon, 7 Aug 2000 11:32:35 -0400
 To:  <hwg-languages(at)hwg.org>
  todo: View Thread, Original
OK, so you know JavaScript??
Well, check this one out.  I was trying to put together a library of
functions that would be all-purpose form validation routines--you know --
routines that would answer simple client-side questions like "Is this email
field in the form mailto:user(at)hostname.domain"? and other such things.
Well, I soon encouraged myself to look for other examples, since I figured I
could take the best of what's out there, and combine it into one great
library.

I found a great resource at Netscape's DevEdge site, complete with commented
code, object-oriented approach, AND a test suite written to support testing
of all the routines and test cases.  (Mana from heaven).  The problem is:
Netscape's code doesn't work under ie 5.  I get an error every time
"Enexpected quantifier".  Despite my best efforts at finding the bug in the
code, I can't figure out why this works perfectly fine in NN, while it fails
in IE.

You can see Netscape's original code and documentation at
http://developer.netscape.com/docs/examples/javascript/regexp/overview.html
or,
http://developer.iplanet.com/docs/examples/javascript/regexp/overview.html
you can see my cleaned and trimmed version at
http://freephile.com/library/js/FormChekTestSuite.html

Ideas i've tried that have not solved the problem:
* eliminating the right parenthesis after the number in each document.write
* changing the 'isBlank' function name to isItBlank (because ie / vbs has a
function defined for isBlank
* changing the name of the 'prompt' function (because JavaScript already has
a 'prompt()' method
Non-functional enhancements to the source code:
* adding semi-colons to the end of every line that should have them.
* formatting if / else statements with curly braces where there is more than
one line.
* formatting functions so that curly brace starts on function declaration
line

Any imput would be greatly appreciated...and the final library will be
available at freephile.com

- Greg Rundlett
greg(at)freephile.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA