Your code seems to work, just a couple of comments :
1. You OnReset function fails in IE 5 and NN as the field you are setting
the focus of does not exist on the form.
2. try using document.form_addnew.title.length > 0 for your evaluation
3. why not test each component individually and then you can give the user
better feedback on what is wrong - see
http://www.greggriffiths.org/contact.html for an example.
4. put your event handler code into functions rather than single lines, it
makes adding to them later easier and makes the code look cleaner.
Your amended code is below :
<html>
<head>
<SCRIPT language="Javascript">
function VerifyData()
{
if ((document.form_addnew.title.value == "") ||
(document.form_addnew.author.value == "") ||
(document.form_addnew.filename.value == "") ||
(document.form_addnew.category.value == "") ||
(document.form_addnew.text.value == ""))
{
alert ("Not all fields are filled in!");
document.form_addnew.title.focus();
return false;
}
else
{
return true;
}
}
function resetFunction()
{
document.form_addnew.title.focus();
}
</SCRIPT>
</head>
<body onload="document.form_addnew.title.focus();">
<form action="process2.asp" method="post" name="form_addnew"
onSubmit="return VerifyData();" onReset="resetFunction();">
<input type="text" length="50" name="title">
<input type="text" length="50" name="author">
<input type="text" length="50" name="filename">
<input type="text" name="category">
<input type="hidden" name="action" value="insert">
<textarea name="text" maxlength="5000" rows="10" cols="50"
wrap="virtual" style="background: EFF3FF;"></textarea>
<input type="submit" value="submit"> <input type="reset">
</form>
</body>
</html>
At 06:51 24/08/01 +0100, you wrote:
><SCRIPT language="Javascript">
><!--
>function VerifyData()
>{
>if ((document.form_addnew.title.value == "") ||
>(document.form_addnew.author.value == "") ||
>(document.form_addnew.filename.value == "") ||
>(document.form_addnew.category.value == "") ||
>(document.form_addnew.text.value == ""))
>
>{
>alert ("Not all fields are filled in!");
>document.form_addnew.title.focus();
>return false;
>}
>else
>{
>return true;
>}
>}
>
>-->
></SCRIPT>
>
>
></head>
>
>
><body onload="document.form_addnew.title.focus();">
>
><form action="process2.asp" method="post" name="form_addnew"
>onSubmit="return VerifyData();"
>onReset="document.form_addnew.name.focus();">
>
><input type="text" length=50 name="title">
><input type="text" length=50 name="author">
><input type="text" length=50 name="filename">
><input type="text" name="category">
><input type="hidden" name="action" value="insert">
><textarea name="text" maxlength="5000" rows="10" cols="50"
>wrap="virtual" style="background: EFF3FF;"></textarea>
><input type="submit" value="submit"> <input type="reset">
></form>