tazbug diff web/lib/functions.js @ rev 119

Tiny edit
author Paul Issott <paul@slitaz.org>
date Sun Feb 12 09:09:36 2017 +0000 (2017-02-12)
parents 5adb233a979b
children
line diff
     1.1 --- a/web/lib/functions.js	Tue Apr 03 12:12:59 2012 +0200
     1.2 +++ b/web/lib/functions.js	Sun Feb 12 09:09:36 2017 +0000
     1.3 @@ -16,3 +16,27 @@
     1.4          return false;
     1.5      }
     1.6  }
     1.7 +
     1.8 +// Check form to avoid empty values and bad email.
     1.9 +function checkSignup() {
    1.10 +	if(document.forms["signup"]["name"].value == "")
    1.11 +    {
    1.12 +        alert("Please enter your real name");
    1.13 +        document.forms["signup"]["name"].focus();
    1.14 +        return false;
    1.15 +    }
    1.16 +    if(document.forms["signup"]["user"].value == "")
    1.17 +    {
    1.18 +        alert("Please fill in your user name");
    1.19 +        document.forms["signup"]["user"].focus();
    1.20 +        return false;
    1.21 +    }
    1.22 +	var x=document.forms["signup"]["mail"].value;
    1.23 +	var atpos=x.indexOf("@");
    1.24 +	var dotpos=x.lastIndexOf(".");
    1.25 +	if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
    1.26 +	{
    1.27 +		alert("Missing or not a valid email address");
    1.28 +		return false;
    1.29 +	}
    1.30 +}