Jump to content

Make a form required


Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">	<head>		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />		<title>Untitled Document</title>		<script type="text/javascript" language="javascript">			function check() {				var elem = document.getElementById('c1');				if(elem.value == 123) {					alert('Right answer');				} else {					alert('Wrong answer');				}			}		</script>	</head>	<body>		<input type="text" id="c1" value="123" />		<input type="submit" onclick="check();" />	</body></html>

Look at this. This is not a secure way to do this kind of check. Use AJAX or only PHP but in this case the page should be reloaded automatically.

Link to post
Share on other sites

Yeah the most secure way to make form fields required is with a server-side language such as PHP, ASP, ColdFusion... since a user cannot override these pages when properly coded.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...