Seltaeb Posted February 21, 2007 Share Posted February 21, 2007 Ok, i'm just started with Javascript and i know not much about it, but i made a little script for my contact form, so people must fill in the things that are marked with " * ". But it's not working, i post it and i hope you can help me! Thanks!function checkform(){ if ( document.contact.naam.value == "" ){ alert ( "Voer uw naam in!" ); return false; } if ( document.contact.email.value == "" ){ alert ( "Voer uw email in!" ); return false; } return true ; } Link to comment Share on other sites More sharing options...
jesh Posted February 21, 2007 Share Posted February 21, 2007 Do you have that function in your form like so: <form id="contact" name="contact" action="mypage.php" method="post" onsubmit="return checkform();"> Link to comment Share on other sites More sharing options...
Seltaeb Posted February 21, 2007 Author Share Posted February 21, 2007 I had this:Wrong: onsubmit="return checkform(this);">Right: onsubmit="return checkform();">Now i've done what you said and nog it works, i removed "this" and it's working good! Thank you! Link to comment Share on other sites More sharing options...
aspnetguy Posted February 21, 2007 Share Posted February 21, 2007 trying to pass a variable to a function that doesn't accept one would do it Good luck learning javascript Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now