tazbug view web/lib/functions.js @ rev 98
Use desc.txt for bug description
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Feb 10 14:54:49 2017 +0100 (2017-02-10) |
parents | 5adb233a979b |
children |
line source
1 // SliTaz Bugs Javascript functions.
2 //
4 // Check form to avoid empty values and bad email.
5 function checkNewBug() {
6 if(document.forms["addbug"]["title"].value == "")
7 {
8 alert("Please enter a title for the new bug");
9 document.forms["addbug"]["title"].focus();
10 return false;
11 }
12 if(document.forms["addbug"]["desc"].value == "")
13 {
14 alert("Please fill in the bug description");
15 document.forms["addbug"]["desc"].focus();
16 return false;
17 }
18 }
20 // Check form to avoid empty values and bad email.
21 function checkSignup() {
22 if(document.forms["signup"]["name"].value == "")
23 {
24 alert("Please enter your real name");
25 document.forms["signup"]["name"].focus();
26 return false;
27 }
28 if(document.forms["signup"]["user"].value == "")
29 {
30 alert("Please fill in your user name");
31 document.forms["signup"]["user"].focus();
32 return false;
33 }
34 var x=document.forms["signup"]["mail"].value;
35 var atpos=x.indexOf("@");
36 var dotpos=x.lastIndexOf(".");
37 if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
38 {
39 alert("Missing or not a valid email address");
40 return false;
41 }
42 }