Posted: Fri Nov 09, 2007 9:34 am Coding for spotting errors in data entered
I am making a webpage and I am adding a section where people can post their demographics and I am wanting it to notify them with a alert when something is entered incorrectly. Can someone help me please? Is there a way to do this with javascripting?
<body bgcolor="#FFFFFF" text="#000000"><SCRIPT TYPE="text/javascript">
<!--
function checkEmail(email)
{
if(email.length > 0)
{
if (email.indexOf(' ') >= 0)
alert("email addresses cannot have spaces in them");
else if (email.indexOf('@') == -1)
alert("a valid email address must have an @ in it");
}
}
//-->
</SCRIPT>
Joined: 24 Jun 2006 Posts: 362 Location: Fort Walton Beach, FL, USA
Posted: Fri Nov 23, 2007 5:37 pm
You CAN do this with JS, but I would advise against it. You have CGI so why not use it, it would be just as easy PLUS people can't turn it off. The code would be very similar, although I can't help you on the specifics because I am not that good in CGI but use something Server-Side not Client-Side.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum