Panjabel Posted September 23, 2008 Share Posted September 23, 2008 <script language="javascript"> function validate(){ if (document.myform.ss1.value == "") { alert("empty field"); return false; } </script> <form name="myform" method="post" onsubmit="return validate()"> <input type="text" name="ss1" id="ss1"> <input type="submit" value="submit"> </form> ??? ??? ??? ??? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted September 23, 2008 Share Posted September 23, 2008 Make you're script this: <script language="javascript"> function validate(){ if (document.myform.ss1.value == "") { alert("empty field"); return false; }else{ return true; } } </script> You're missing the closing of the if statement, I also added an else and returned true. Quote Link to comment Share on other sites More sharing options...
Panjabel Posted September 23, 2008 Author Share Posted September 23, 2008 thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.