<scriptlanguage="JavaScript"> | |
<!-- | |
function IsNumeric(sText) | |
{ | |
var ValidChars = ",-()+0123456789 "; | |
var IsNumber=true; | |
var Char; | |
for (i = 0; i < sText.length && IsNumber == true; i++) | |
{ | |
Char = sText.charAt(i); | |
if (ValidChars.indexOf(Char) == -1) | |
{ | |
IsNumber = false; | |
} | |
} | |
return IsNumber; | |
} | |
function validate() | |
{ | |
if(document.form.name.value==" | |
{ | |
alert("Please Enter Value for Name Field"); | |
document.form.name.focus(); | |
return false; | |
} | |
if(document.form.email.value== | |
{ | |
alert("Please Enter Value for E-Mail Field"); | |
document.form.email.focus(); | |
return false; | |
} | |
if(!isEmail(document.form. | |
{ alert("Please enter the valid email address."); | |
document.form.email.select(); | |
document.form.email.focus(); | |
return false; } | |
if(document.form.phone.value== | |
{ | |
alert("Please Enter Value for Telephone Field"); | |
document.form.phone.focus(); | |
return false; | |
} | |
if (!IsNumeric(document.form. | |
{ | |
alert ('Phone number seems incorrect!'); | |
document.form.phone.focus(); | |
return (false); | |
} | |
if(document.form.firstChoice. | |
{ | |
alert("Please Select Project/Location"); | |
document.form.firstChoice. | |
return false; | |
} | |
if(document.form.secondChoice. | |
{ | |
alert("Please Select Project/Location"); | |
document.form.secondChoice. | |
return false; | |
} | |
if(document.form.thirdChoice. | |
{ | |
alert("Please Select Project/Location"); | |
document.form.thirdChoice. | |
return false; | |
} | |
if(document.form.appbudg. | |
{ | |
alert("Please Select Your Budget"); | |
document.form.appbudg.focus(); | |
return false; | |
} | |
if(document.form.query.value== | |
{ | |
alert("Please Enter Value for Query Field"); | |
document.form.query.focus(); | |
return false; | |
} | |
return true; | |
} | |
function isEmail (emailIn){ | |
var isEmailOk = false; | |
//var filter = /^[a-zA-Z0-9][a-zA-Z0-9._-]*\@ | |
var filter = /^(([^<>()[\]\\.,;:\s@\”]+(\.[ | |
if(emailIn.search(filter) != -1) | |
isEmailOk = true; | |
if(emailIn.indexOf("..") != -1) | |
isEmailOk = false; | |
if(emailIn.indexOf(".@") != -1) | |
isEmailOk = false; | |
return isEmailOk; | |
} | |
//--> | |
</script> |
Editors Picks
Saturday, July 3, 2010
Java Script For Validation
Labels:
AJAX and Java Script
Subscribe to:
Post Comments
(
Atom
)
Topics
.NET Error
AJAX and Java Script
ASP.NET
Asp.net Interview Question And Answer
aspx page to pdf
C#
C# Interview Question And Answer
C#.Oracle
CSS
Data List
Dynamic Controls
Excel
Google Map Api
Grid View
HINDI
IIS
Microsoft Certifications
MS Chart
my sql
OOPS
Oracle
Security
Send Email
Send SMS
SQL SERVER
State management
Webconfig
Windows
Windows Services
WPF
XML
No comments :
Post a Comment