forked from yasirkhan091/CouponAdda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.js
47 lines (45 loc) · 1003 Bytes
/
form.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
function validateForm()
{
let co=document.myform.code.value;
let dt=document.myform.date.value;
let desc=document.myform.description.value;
let company=document.myform.company.value;
let pr=document.myform.price.value;
let logo=document.myform.logo.value;
if(company.value==-1 && logo.files.length==0)
{
console.log("HELLO WORLD1");
alert("Both fields cannot be empty!!!");
return false;
}
console.log("HELLO WORLD");
if(company.value!=-1 && logo.files.length!=0)
{
console.log("HELLO WORLD12");
alert("you cannot enter both the fields");
return false;
}
if(co.length<1)
{
alert("coupon code cannot be empty!!!");
return false;
}
if(!dt)
{
alert("Please set the expiry date of the coupon!!!");
return false;
}
if(!desc)
{
alert("Please fill the description of the coupon!!!");
return false;
}
if(pr<1)
{
alert("Do you want to sell your coupon for free???");
return false;
}
console.log("HELLO WORLD");
console.log("HELLO WORLD");
return true;
}