Click to See Complete Forum and Search --> : help please
drigby
12-31-2002, 10:35 AM
Is anybody familiar with the javascript found at this URL: http://javascript.internet.com/forms/validation.html
I have followed the directions for using and placing the code, but it is not operational. If anybody has any suggestions to make this work or if anybody knows where to find another script that simply allows a user to enter their contact info and a question, it would be of great help. thanks
khalidali63
12-31-2002, 10:44 AM
the code on the link provided is functional,and your question is about the code that does not work on your machine,how do you think its possible to figure out the error?
:-)
Please post your code here or a link to the page who's code does not work
Khalid
drigby
12-31-2002, 11:13 AM
Khalid, here is the code, and thank you.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function checkFields() {
missinginfo = "";
if (document.form.name.value == "") {
missinginfo += "\n - Name";
}
if ((document.form.from.value == "") ||
(document.form.from.value.indexOf('@') == -1) ||
(document.form.from.value.indexOf('.') == -1)) {
missinginfo += "\n - Email address";
}
if ((document.form.website.value == "") ||
(document.form.website.value.indexOf("http://") == -1) ||
(document.form.website.value.indexOf(".") == -1)) {
missinginfo += "\n - Web site";
}
if(document.form.comments.value == "") {
missinginfo += "\n - Comments";
}
if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}
// End -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name=form onSubmit="return checkFields();">
<input type=hidden name=to value='you @ your domain . web'>
<input type=hidden name=subject value="Freedback">
<pre>
Name: <input type=text name="name" size=30>E-mail: <input type=text name="from" size=30>
Web Site: <input type=text value="http://" name="website" size=30>
Comments:
<textarea rows=3 cols=40 name="comments"></textarea>
<input type=submit name="submit" value="Submit Form!">
</pre>
</form>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
</body>
</html>