By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,281 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Good validation package

P: n/a
Hello,

Is there a good validation package out there that can be used with
javascript? I have tried the one here:

http://www.peterbailey.net/fValidate/

but had some problems implementing it ;-(

I have seen the one from Dreamweaver but I am not using this package.

Is there anything else out there that one can use?
Any help, hints or advice would be appreciated ;-)

TIA

Jul 23 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
On 13 Dec 2004 11:05:19 -0800, milkyway <d0******@hotmail.com> wrote:

[snip]
I have tried the one here:

http://www.peterbailey.net/fValidate/

but had some problems implementing it ;-(
I'm somewhat glad. Serving up over 50KBs of code to validate a few form
controls is stupid.
I have seen the one from Dreamweaver but I am not using this package.
Most of the code I've seen generated by Dreamweaver is rubbish. I'd be
surprised if the form validation stuff is any better.
Is there anything else out there that one can use?
What are you actually trying to validate? It's far more sensible to use
something small and efficient.
Any help, hints or advice would be appreciated ;-)


On a different topic, please post to appropriate newsgroups. This solution
has nothing to do with Java, and ciwah deals with authoring HTML on the
Web not scripting.

Follow-ups set to c.l.js.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2

P: n/a
HI - sorry about the posting. Just still learning all of this.

I am trying to validate data for: strings, numbers, money, social,
phone number, date and zipcode.

I had thought that there would be a way to validate these things on the
client side.

Any ideas?

Kind Regards.

Jul 23 '05 #3

P: n/a
Michael Winter wrote
On 13 Dec 2004 11:05:19 -0800, milkyway <d0******@hotmail.com> wrote:

[snip]
I have tried the one here:

http://www.peterbailey.net/fValidate/

but had some problems implementing it ;-(


I'm somewhat glad. Serving up over 50KBs of code to validate a few form
controls is stupid.
I have seen the one from Dreamweaver but I am not using this package.


Most of the code I've seen generated by Dreamweaver is rubbish. I'd be
surprised if the form validation stuff is any better.
Is there anything else out there that one can use?


What are you actually trying to validate? It's far more sensible to use
something small and efficient.
Any help, hints or advice would be appreciated ;-)


On a different topic, please post to appropriate newsgroups. This solution
has nothing to do with Java, and ciwah deals with authoring HTML on the
Web not scripting.

Follow-ups set to c.l.js.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


When the javascript is included with the

<link rel="script" type="text/javascript" href="URI/xxx.js">

<LINK REL="STYLESHEET" TYPE="TEXT/JAVASCRIPT" HREF="classes.jss">

Tag, then the javascript exists only one time on the the client.

see at

http://www.iota-six.co.uk/html/14_jss.htm

search over ctrl f 'link'

--
Heiner Kuecker
Internet: http://www.heinerkuecker.de http://www.heiner-kuecker.de
JSP WorkFlow PageFlow Page Flow FlowControl Navigation: http://www.control-and-command.de
Java Expression Formula Parser: http://www.heinerkuecker.de/Expression.html
CnC Template Technology http://www.heinerkuecker.de/Expression.html#templ
Jul 23 '05 #4

P: n/a
On Mon, 13 Dec 2004 23:30:47 +0100, Heiner Kücker <Ma**@Heiner-Kuecker.de>
wrote:

[snip]
When the javascript is included with the

<link rel="script" type="text/javascript" href="URI/xxx.js">
Excuse me? You don't include scripts with LINK elements.
<LINK REL="STYLESHEET" TYPE="TEXT/JAVASCRIPT" HREF="classes.jss">


As far as I'm aware, only Netscape supports JSS, so what is the point?

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #5

P: n/a
Michael Winter wrote:
On Mon, 13 Dec 2004 23:30:47 +0100, Heiner Kücker
<Ma**@Heiner-Kuecker.de> wrote:

[snip]
<LINK REL="STYLESHEET" TYPE="TEXT/JAVASCRIPT" HREF="classes.jss">

As far as I'm aware, only Netscape supports JSS, so what is the point?


What does and doesn't support JSS is irrelevant though, is it not?

<script type="text/javascript" src="someFile.someMadeUpExtenstion">

As long as whats in that file is valid JS code, the browser couldn't
care less what the extension is :-)
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #6

P: n/a
On Mon, 13 Dec 2004 17:56:43 -0500, Randy Webb <Hi************@aol.com>
wrote:

[snip]
What does and doesn't support JSS is irrelevant though, is it not?
I think that the poster was, for some reason, referring specifically to
Javascript Style Sheets. Why? I don't know.
<script type="text/javascript" src="someFile.someMadeUpExtenstion">

As long as whats in that file is valid JS code, the browser couldn't
care less what the extension is :-)


I know that! :P

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #7

P: n/a
On 13 Dec 2004 12:25:16 -0800, milkyway <d0******@hotmail.com> wrote:
HI - sorry about the posting. Just still learning all of this.

I am trying to validate data for: strings, numbers, money, social, phone
number, date and zipcode.
You're going to have to be more specific than that, especially considering
that I'm in a different country than you. I've had a quick look for
US-specific formats, but I might be the victim of misinformation.

- Strings
Are you just looking for strings that aren't zero-length or
composed solely of white-space, or more complex? The former would
be

/^\S+$/ or /^\S+( \S+)*$/

if you want a space-separated sequence.

- Numbers
Easy, but again varied.

- Integers? /^(0|[1-9]\d*)$/
- Reals? /^(0|[1-9]\d*)\.\d+$/
- Possibly both? /^(0|[1-9]\d*)(\.\d+)?$/

- Money
/^(0|[1-9]\d*)(\.\d\d)?$/

though you might want to limit the number of digits before the
decimal place.

- Social (Security?)
/^\d{3}-\d\d-\d{4}$/

- Phone number
Phone numbers are notoriously difficult as different systems,
even within the same country, can vary. If you have to deal with
international numbers, you're in for a real treat.

- Date
Which format(s)? If you expect international audiences, a
locale-specific format such as mm/dd/yyyy is generally a bad idea.

- Zipcode
/^\d{5}$/ or /^\d{5}(-\d{4})?$/

for optional inclusion of the extra four digits

To use the regular expression literals above, you'd append

.test(...)

where the ellipses represents a string value. For example,

if(/^(0|[1-9]\d*)$/.test(str)) {
/* The string, str, contains a valid integer. */
}
I had thought that there would be a way to validate these things on the
client side.


Undoubtably, but if you haven't so far, worry about validation on the
server first. That's more important.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #8

P: n/a
Form Validation bundled with Dreamweaver is pretty basic but works.

There are extensions that are available at Macromedia's Exchange that
plug into Dreamweaver and are more robust and if you don't like anything
you find you can always use your own Form Validation code in
Dreamweaver. Coding in Dreamweaver is pretty good since it swallowed
Homesite.....

--
FN
Jul 23 '05 #9

P: n/a
JRS: In article <11**********************@f14g2000cwb.googlegroups .com>
, dated Mon, 13 Dec 2004 12:25:16, seen in news:comp.lang.javascript,
milkyway <d0******@hotmail.com> posted :
HI - sorry about the posting. Just still learning all of this.
Read the newsgroup FAQ.
I am trying to validate data for: strings, numbers, money, social,
phone number, date and zipcode.

I had thought that there would be a way to validate these things on the
client side.

Any ideas?


Read <URL:http://www.merlyn.demon.co.uk/js-valid.htm>.

You do not indicate what country you are in, so can be supposed to be
American. Remember overseas customers, and non-USA Americans. Even if
you supply only within the USA, you customers may be using a non-US
location. Do not over-validate.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #10

P: n/a
Flash Nick wrote:
Form Validation bundled with Dreamweaver is pretty basic but works.
That depends, entirely, upon your definition of "works".

99.99% of code generated by Dreamweaver is utterly useless space wasting
garbage. I stopped short of 100% in the hopes that one day they may
actually get a clue about scripting and produce something worth using.

Coding in Dreamweaver is pretty good since it swallowed Homesite.....


Using it as an editor may be "pretty good" but the code it produces is
still garbage.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #11

P: n/a
Thank you for the information ;-) I will try these out

Kindest Regards.

Michael Winter wrote:
On 13 Dec 2004 12:25:16 -0800, milkyway <d0******@hotmail.com> wrote:
HI - sorry about the posting. Just still learning all of this.

I am trying to validate data for: strings, numbers, money, social, phone number, date and zipcode.
You're going to have to be more specific than that, especially

considering that I'm in a different country than you. I've had a quick look for
US-specific formats, but I might be the victim of misinformation.

- Strings
Are you just looking for strings that aren't zero-length or
composed solely of white-space, or more complex? The former would be

/^\S+$/ or /^\S+( \S+)*$/

if you want a space-separated sequence.

- Numbers
Easy, but again varied.

- Integers? /^(0|[1-9]\d*)$/
- Reals? /^(0|[1-9]\d*)\.\d+$/
- Possibly both? /^(0|[1-9]\d*)(\.\d+)?$/

- Money
/^(0|[1-9]\d*)(\.\d\d)?$/

though you might want to limit the number of digits before the
decimal place.

- Social (Security?)
/^\d{3}-\d\d-\d{4}$/

- Phone number
Phone numbers are notoriously difficult as different systems,
even within the same country, can vary. If you have to deal with
international numbers, you're in for a real treat.

- Date
Which format(s)? If you expect international audiences, a
locale-specific format such as mm/dd/yyyy is generally a bad idea.
- Zipcode
/^\d{5}$/ or /^\d{5}(-\d{4})?$/

for optional inclusion of the extra four digits

To use the regular expression literals above, you'd append

.test(...)

where the ellipses represents a string value. For example,

if(/^(0|[1-9]\d*)$/.test(str)) {
/* The string, str, contains a valid integer. */
}
I had thought that there would be a way to validate these things on the client side.
Undoubtably, but if you haven't so far, worry about validation on the

server first. That's more important.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.


Jul 23 '05 #12

P: n/a
Thanks to all for the help ;-p
Dr John Stockton wrote:
JRS: In article <11**********************@f14g2000cwb.googlegroups .com> , dated Mon, 13 Dec 2004 12:25:16, seen in news:comp.lang.javascript,
milkyway <d0******@hotmail.com> posted :
HI - sorry about the posting. Just still learning all of this.
Read the newsgroup FAQ.
I am trying to validate data for: strings, numbers, money, social,
phone number, date and zipcode.

I had thought that there would be a way to validate these things on theclient side.

Any ideas?


Read <URL:http://www.merlyn.demon.co.uk/js-valid.htm>.

You do not indicate what country you are in, so can be supposed to be
American. Remember overseas customers, and non-USA Americans. Even

if you supply only within the USA, you customers may be using a non-US
location. Do not over-validate.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 © <URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ

items, links.

Jul 23 '05 #13

P: n/a
JRS: In article <11**********************@z14g2000cwz.googlegroups .com>
, dated Tue, 14 Dec 2004 21:47:07, seen in news:comp.lang.javascript,
milkyway <d0******@hotmail.com> posted :
Lines: 39 Thanks to all for the help ;-p
Dr John Stockton wrote:
JRS: In article

<1102969516.735695.297080@
... ...

If you think that you may need more help, read and respect FAQ sec 2.3,
especially paragraphs 1 & 6.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #14

P: n/a
I don't know if anyone is watching this but I found something (don't
know if it is actually good or not) in the struts examples found on the
apache strut website. There are .war files there for examples you can
use to work with struts. One of the examples has a good amount of
javascript code (that is used as part of a form validation example).

You can see the list of packages offered here
http://struts.apache.org/userGuide/installation.html

under the bullet of "Other Packages". Again, *one* of these .war files
has javascript validation code. I think it is the one called
"Validator".

Jul 23 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.