ShaolinF Posted October 14, 2007 Share Posted October 14, 2007 Hi Guys, What I want is when a user doesnt fill in a field on a form and presses next, I want that page to say 'Error, you have not filled in this field', rather than having to load another page with the comment. How can I do this ? Quote Link to comment Share on other sites More sharing options...
mattal999 Posted October 14, 2007 Share Posted October 14, 2007 javascript... search on google for: javascript form validation. Quote Link to comment Share on other sites More sharing options...
ShaolinF Posted October 14, 2007 Author Share Posted October 14, 2007 Thanks. I managed to find a way but cant get it to work. Here is the thread if you want to give a hand: http://www.phpfreaks.com/forums/index.php/topic,163447.msg716558.html#new Quote Link to comment Share on other sites More sharing options...
mattal999 Posted October 14, 2007 Share Posted October 14, 2007 try this instead: <form action="continue.php" method="post" name="signup" onSubmit="return myformcheck()"> <p align="center"> Username: <input type="text" name="name" size="20"><br> Password: <input type="text" name="contact" size="20"><br> E-mail : <input type="text" name="email" size="20"><br> <input type='submit' value='Go'> <script language="Javascript"> function postregister() { if ((document.signup.name.value == '') || (document.signup.contact.value == '') || (document.signup.email.value == '')) { alert('You have to enter a valid name, contact number and email.'); } else { document.signup.submit(); } } </script></form> post back to let me know if it works. 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.