RE: onSubmit

by "Brian A. Sayrs" <sayrs(at)southwindsolutions.com>

 Date:  Mon, 10 Apr 2000 17:47:38 -0700
 To:  "'Mat Gessel'" <mat(at)lizardking.com>,
hwg-techniques <hwg-techniques(at)mail.hwg.org>
  todo: View Thread, Original
I don't want to start a fight here... (have you ever noticed that when =
someone says that, a fight occurs?)

Technically, 0 is not a boolean value, it's an integer.  True and False =
are the only determinate boolean values.  The JavaScript standard does =
allow non-boolean values to be coerced into boolean values (that is, =
JavaScript is supposed to turn 0 into false and everything else to =
true), but that's just because it only has one kind of scalar value.  =
Java, for example, doesn't allow it.

So, while it is wrong for MSIE 5 to fail the coercion mandate, it's not =
because 0 and 1 are boolean values.  It's because MS undoubtedly wrote =
its JavaScript engine in a strongly typed language, and they didn't =
think that anyone would use 0 and 1 as boolean values.  (Which *ahem* =
they shouldn't.)

Still not an excuse, of course!  :)

I have to say that I'm fond of strongly typed languages for object =
oriented development (which is redundant, really), but for scripting =
languages meant for use by non-to-amateur-programmers like JavaScript, I =
have to say it's unreasonable to expect strong typing.

Brian A. Sayrs
Owner, Southwind Solutions

(Let the battle begin!)


-----Original Message-----
From:	Mat Gessel [SMTP:mat(at)lizardking.com]
Sent:	Monday, April 10, 2000 4:08 PM
To:	hwg-techniques
Subject:	Re: onSubmit

JavaScript fully implements Boolean values. Win IE5 apparently only =
supports
true/false.

Here's a working example on my site:
http://www.lizardking.com/fb

When I tried changing "return false" to" return 0" it broke the script.
--=20
Mat Gessel
mat(at)lizardking.com
http://www.lizardking.com
All I wanted was a Pepsi...

> From: Jay Strickland <Jay_Strickland(at)pobox.com>
> Reply-To: "Jay_Strickland(at)pobox.com" <Jay_Strickland(at)pobox.com>
> Date: Sun, 9 Apr 2000 12:46:37 -0600
> To: "'hwg-techniques(at)hwg.org'" <hwg-techniques(at)hwg.org>
> Subject: onSubmit
>=20
> Obviously I've only included portions of the code for simplicity.  The
> alert box comes up just fine, but for some reason returning 0 to the
> onSubmit isn't keeping the form from continuing with the submit.  I'm
> testing with IE5.

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

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.