[Mapbender-commits] r8321 - branches/2.7/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Apr 19 03:26:15 EDT 2012


Author: verenadiewald
Date: 2012-04-19 00:26:15 -0700 (Thu, 19 Apr 2012)
New Revision: 8321

Modified:
   branches/2.7/http/plugins/mb_print.php
Log:
validate maxlength parameter for textarea elements

Modified: branches/2.7/http/plugins/mb_print.php
===================================================================
--- branches/2.7/http/plugins/mb_print.php	2012-04-19 07:25:43 UTC (rev 8320)
+++ branches/2.7/http/plugins/mb_print.php	2012-04-19 07:26:15 UTC (rev 8321)
@@ -575,6 +575,7 @@
 			
 			if(element.maxCharacter) {
 				var maxLength = 'maxlength="'+element.maxCharacter+'"';
+				
 			}
 			else {
 				var maxLength = "";
@@ -601,6 +602,14 @@
 			str += '</div>\n';
 		}
 		if (str) {
+			$('textarea[maxlength]').live('keyup change', function() {
+              	var str = $(this).val()
+              	var mx = parseInt($(this).attr('maxlength'))
+              	if (str.length > mx) {
+                 	$(this).val(str.substr(0, mx))
+                 	return false;
+              	}
+            });
 			$("#" + myId + "_formsubmit").before(str);
 			$("#scale").keydown(function (e) {
 				if (e.keyCode === 13) {



More information about the Mapbender_commits mailing list