-
Notifications
You must be signed in to change notification settings - Fork 1
/
validate.js
75 lines (69 loc) · 1.58 KB
/
validate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
function checkForm()
{
//ok=true;
if(document.loginform.contact.value=="")
{
alert("Please Enter Contact Person Name.")
document.loginform.contact.focus()
return false;
}
if(document.loginform.product.value=="")
{
alert("Please Enter Your Product Category.")
document.loginform.product.focus()
return false;
}
if(document.loginform.company.value=="")
{
alert("Please Enter Your Company Name.")
document.loginform.company.focus()
return false;
}
if(document.loginform.code.value=="")
{
alert("Please Enter Your Product Code.")
document.loginform.code.focus()
return false;
}
if(document.loginform.phone.value=="")
{
alert("Please Enter Your Contact No..")
document.loginform.phone.focus()
return false;
}
if(document.loginform.colour.value=="")
{
alert("Please Enter Colour.")
document.loginform.colour.focus()
return false;
}
if(document.loginform.email.value=="")
{
alert("Please Enter Your Email.")
document.loginform.email.focus()
return false;
}
else
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.loginform.email.value;
if(reg.test(address) == false)
{
alert('Invalid Email Address');
return false;
}
}
if(document.loginform.quantity.value=="")
{
alert("Please Enter Your Quantity.")
document.loginform.quantity.focus()
return false;
}
}
function ValidateNum(input,event){
var keyCode = event.which ? event.which : event.keyCode;
if(parseInt(keyCode)>=48 && parseInt(keyCode)<=57){
return true;
}
return false;
}// JavaScript Document