From 10a699759d4f106f29c077a6d65d3b8d212825e5 Mon Sep 17 00:00:00 2001 From: thomascube Date: Sun, 6 Nov 2005 19:26:45 +0000 Subject: Added localized messages to client and check form input --- program/js/common.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'program/js/common.js') diff --git a/program/js/common.js b/program/js/common.js index 78fecf8fe..0c9917ad9 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -6,7 +6,7 @@ | Copyright (C) 2005, RoundCube Dev, - Switzerland | | Licensed under the GNU GPL | | | - | Modified:2005/10/21 (roundcube) | + | Modified:2005/11/06 (roundcube) | | | +-----------------------------------------------------------------------+ | Author: Thomas Bruederli | @@ -264,6 +264,19 @@ function rcube_layer(id, attributes) } +// check if input is a valid email address +function rcube_check_email(input, inline) + { + if (input && window.RegExp) + { + var reg_str = '([a-z0-9][-a-z0-9\.\+_]*)\@([a-z0-9]([-a-z0-9][\.]?)*[a-z0-9]\.[a-z]{2,9})'; + var reg1 = inline ? new RegExp(reg_str, 'i') : new RegExp('^'+reg_str+'$', 'i'); + var reg2 = /[\._\-\@]{2}/; + return reg1.test(input) && !reg2.test(input) ? true : false; + } + return false; + } + // find a value in a specific array and returns the index function find_in_array() -- cgit v1.2.3