Jump to content

Making form fields compulsory


unplugged_web
 Share

Recommended Posts

The problem with that is, you have to create a nother page error.php for example to diplay the, sorry you missed another page comment.i like to use javascript to do that, so it would prompt the user.

<??><script language="javascript"   type="text/javascript">function validateForm(register){if(""==document.forms.register.email.value){alert("Please enter your email address.");return false;}repeat for more fields} </script> <form name="register" method="post" action="registration_confirm.php" onSubmit="return validateForm(register);"><input type="text" name="email" size="30" value=""></form>

Link to comment
Share on other sites

But careful, users can always disable JavaScript, thereby submitting their invalid form. For ease-of-use, you can use JS, but always have a server-side fallback.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...