[Koha-cvs] koha/koha-tmpl/intranet-tmpl/prog/en/admin cate... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Wed Oct 18 12:28:07 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/10/18 10:28:07

Modified files:
	koha-tmpl/intranet-tmpl/prog/en/admin: categorie.tmpl 

Log message:
	Fix JavaScript error when checking the html form & add a check condition

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.1&r2=1.3.2.2

Patches:
Index: categorie.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/admin/categorie.tmpl,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -b -r1.3.2.1 -r1.3.2.2
--- categorie.tmpl	17 Oct 2006 16:56:55 -0000	1.3.2.1
+++ categorie.tmpl	18 Oct 2006 10:28:07 -0000	1.3.2.2
@@ -42,35 +42,40 @@
 			return false;
 		}
 	}
-	//
-	function Check(f) {
-		var ok=1;
-		var _alertString="";
-		var alertString2;
-		if (f.categorycode.value.length==0) {
+	// to check if the data are correctly entered.
+	function Check(ff) {
+	    var ok=0;
+		var _alertString="Form not submitted because of the following problem(s)\n";
+		_alertString +="-------------------------------------------------------------------\n\n";
+		if (ff.categorycode.value.length==0) {
+		    ok=1;
 			_alertString += "- categorycode missing\n";
 		}
-//		alert(window.document.Aform.description.value);
-		if (!(isNotNull(window.document.Aform.description,1))) {
+		if (!(ff.category_type.value)){
+		    ok=1;
+		    _alertString += "- category type missing\n";
+		}
+		if (!(isNotNull(ff.description,1))) {
+		    ok=1;
 			_alertString += "- description missing\n";
 		}
-		if (!isNum(f.upperagelimit,0)) {
+		if (!isNum(ff.upperagelimit,0)) {
+		    ok=1;
 			_alertString += "- upperagelimit is not a number\n";
 		}
-		if (_alertString.length==0) {
-			document.Aform.submit();
-		} else {
-			alertString2 = "Form not submitted because of the following problem(s)\n";
-			alertString2 += "------------------------------------------------------------------------------------\n\n";
-			alertString2 += _alertString;
-			alert(alertString2);
+		
+		if (ok) { // if there is a problem
+			alert(_alertString);
+            return;
 		}
+        // if all is good
+		ff.submit();
 	}
 	</script>
 
 
 	
-	<form action="<!-- TMPL_VAR NAME="script_name" -->" name="Aform" method="post">
+	<form name="Aform" action="<!-- TMPL_VAR NAME="script_name" -->" method="post">
 	<input type="hidden" name="op" value="add_validate" />
 	<input type="hidden" name="checked" value="0" />
 <!-- TMPL_IF NAME="categorycode" -->





More information about the Koha-cvs mailing list