maybe he was thinking you have to use window.alert, which would be the
pedantically correct way of putting it, as "alert" is a method of the window
object ... but of course the window object is implied when using javascript
or vbscript in the browser so theres no actual need.
-----Original Message-----
From: O'Hara, Elliott M [mailto:EMOHARA@k...]
Sent: 28 June 2001 16:53
To: javascript
Subject: [javascript] RE: Quick Form Verification Question
huh??
was I the only one lost on that response???
Alex was right by the way (he usually is)
-----Original Message-----
From: Fred Creach [mailto:fcreach@i...]
Sent: Thursday, June 28, 2001 11:26 AM
To: javascript
Subject: [javascript] RE: Quick Form Verification Question
I cannot positively tell you what to put in there, but the reason I think
you get those undefined and must be 6 long is because of those alerts,
instead of those, you should have something else I think, get some input
from other people as well, but I think there is something else that should
be there before that alert. Sorry thats all I can say. Good Luck
Fred
-----Original Message-----
From: George Smyth [mailto:george.smyth@U...]
Sent: Thursday, June 28, 2001 8:05 AM
To: javascript
Subject: [javascript] Quick Form Verification Question
I've apparently got a fundamental misunderstanding of form verification.
I've simplified my code to the following:
<html><head>
<script language=JavaScript>
<!--
function CheckEntries() {
var AlphaLength = document.form1.txtAlpha.length
if (AlphaLength != 6) {
alert ("The Alpha Number field must contain all six digits.");
alert ("Length is " + AlphaLength);
return false;
}
}
// -->
</script>
</head>
<body>
<form name="form1" method="post" action="Test.asp">
<table>
<tr>
<td><b>Alpha Number</td>
<td><input type="text" name="txtAlpha" size="6" maxlength="6"></td>
</tr><tr>
<td colspan="2"><input type="submit" onclick="return
CheckEntries()"></td>
</tr>
</table>
</form>
</body>
</html>
When I enter six characters and click the Submit button, I get the Alert box
telling me that the field must contain six characters, and another telling
me that the length is undefined.
Apparently I am missing something rather basic and would appreciate any help
in this regard.
Cheers -
george