Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

Form Validation

Javascript coding ..

Moderators: macek, egami, gesf

Form Validation

Postby prince » Mon Apr 09, 2012 10:10 pm

Am not getting properly with form validations. Can anyone help me...




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function validate Form()
{
var x=document.forms["test"]["Email"].value
if (x==null || x=="")
{
alert("Please Enter E-mail ID ");
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(reg.test(x1) == false) {
alert('Invalid Email Address');
document.getElementById('t3').focus();
return false;
}
var full=document.forms["test"]["Password"].value
if (full==null || full=="")
{
alert("Please Enter the Password ");
return false;
}
var f=document.forms["test"]["ID"].value
if (f==null || f=="")
{
alert("Please Enter the GA-ID ");
return false;
}

}
</script>
</head>
<body>
<form name= "test" method="post" action="" onsubmit= "return validateFormOnSubmit(this)">

E-mail: <input type="text" name="Email" /> <br /> <br />

Password: <input type="password" name="Password" /> <br /> <br />

GA-ID: <input type="text" name="ID" maxlength="9"/> <br /> <br />

<input type="submit" />
</form>
</body>
</html>
<?php


?>
prince
New php-forum User
New php-forum User
 
Posts: 15
Joined: Mon Mar 26, 2012 3:43 am

Re: Form Validation

Postby egami » Tue Apr 10, 2012 4:46 am

This is a javascript problem and not PHP.. moving to javascript.
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Form Validation

Postby prince » Wed Apr 11, 2012 12:34 am

oh !!!!

Thank you
prince
New php-forum User
New php-forum User
 
Posts: 15
Joined: Mon Mar 26, 2012 3:43 am


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.