[Cluster-devel] conga/luci/homebase homebase_common.js
rmccabe at sourceware.org
rmccabe at sourceware.org
Wed Aug 16 22:59:09 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-08-16 22:59:09
Modified files:
luci/homebase : homebase_common.js
Log message:
utility fn for validating integer input
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
--- conga/luci/homebase/homebase_common.js 2006/08/16 19:08:36 1.3
+++ conga/luci/homebase/homebase_common.js 2006/08/16 22:59:09 1.4
@@ -1,3 +1,16 @@
+function is_valid_int(str, min, max) {
+ if (str.match(/[^0-9 ]/))
+ return (0);
+ var val = parseInt(str, 10);
+ if (!val || isNaN(val))
+ return (0);
+ if (min != null && val < min)
+ return (0);
+ if (max != null && val > max)
+ return (0);
+ return (1);
+}
+
function error_dialog(errors) {
if (!errors || errors.length < 1)
return (null);
More information about the Cluster-devel
mailing list