logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-11-2009, 12:00 PM   #1
Rich_A06
 
Join Date: Oct 2006
Posts: 74
Default Cannot stop php

The check works but it runs the contact.php which I don't want it to do if js shows a popup window.
Code:
<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>
Rich_A06 is offline   Reply With Quote
Old 01-12-2009, 12:05 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

not my thing javascript but shouldnt
return validate() be just
validate()
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-12-2009, 09:22 AM   #3
Rich_A06
 
Join Date: Oct 2006
Posts: 74
Default

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.

Last edited by Rich_A06; 01-12-2009 at 09:26 AM..
Rich_A06 is offline   Reply With Quote
Old 01-19-2009, 02:11 PM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

Code:
onsubmit="return validate()"
should be

Code:
onsubmit="validate()"
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:39 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com