PDA

View Full Version : Cannot stop php


Rich_A06
01-11-2009, 12:00 PM
The check works but it runs the contact.php which I don't want it to do if js shows a popup window.

<html>
<head>
<script>
function validate()
{
if (document.forms[0].Email.value == "")
{
alert("User Name is a required field. Please fill in your User Name.");
document.forms[0].focus();
document.forms[0].select();
return false;
}
return true;
}
</script>
</head>
<body>
<form action="contact.php" method="post" name="Contact" id="Contact" onsubmit="return validate();">
<input name="Email" type="text" class="form_input" id="Email" size="34">
<input name="Submit" type="submit" value="Submit">
</form>
</body>
</html>

edbr
01-12-2009, 12:05 AM
http://www.dreamweaverclub.com/forum/images/editor/separator.gifnot my thing javascript but shouldnt
return validate() be just
validate()

Rich_A06
01-12-2009, 09:22 AM
You might be right however, I found this site http://www.freeformmaker.com/ (after spending hours looking for code only to find a simply google for "free form generator" gave me what I wanted!). It works perfectly, I made one preview with all types of form, customised it a bit, then made a template and am very pleased with the result. The auto response didn't work for me, neither the text file generation but the rest all works perfect. It's html/php/css mix, totally styleable.

davidj
01-19-2009, 02:11 PM
onsubmit="return validate()"

should be

onsubmit="validate()"