[Mapbender-commits] r2679 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 21 08:25:22 EDT 2008


Author: verenadiewald
Date: 2008-07-21 08:25:22 -0400 (Mon, 21 Jul 2008)
New Revision: 2679

Modified:
   trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:
added "mb_digitize_form_" string to id value of input fields to avoid javascript error when id value is a javascript keyword (example: id='length', will be now id='mb_digitize_form_length')

Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php	2008-07-21 08:44:51 UTC (rev 2678)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php	2008-07-21 12:25:22 UTC (rev 2679)
@@ -1293,9 +1293,9 @@
 					}
 					var formElementHtml = featureTypeElement['f_form_element_html']; 
 					if (!formElementHtml || !formElementHtml.match(/<select/)) {
-						str += "\t\t\t\t<input id = 'datatype_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
-						str += "\t\t\t\t<input id = 'mandatory_" + elementName + "' name='mandatory' type='hidden' value = '" + isMandatory + "'>\n";
-						str += "\t\t\t\t<input id = '" + elementName + "' name='" + elementLabel + "' type='text' class = '"+featureTypeElement['f_style_id']+"' size=20 value = '" + elementValue + "'>\n";
+						str += "\t\t\t\t<input id = 'datatype_mb_digitize_form_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
+						str += "\t\t\t\t<input id = 'mandatory_mb_digitize_form_" + elementName + "' name='mandatory' type='hidden' value = '" + isMandatory + "'>\n";
+						str += "\t\t\t\t<input id = 'mb_digitize_form_" + elementName + "' name='" + elementLabel + "' type='text' class = '"+featureTypeElement['f_style_id']+"' size=20 value = '" + elementValue + "'>\n";
 					}
 					else {
 							while (formElementHtml.match(/\\/)) {
@@ -1393,7 +1393,8 @@
 				}
 				else if (myform.elements[i].type == 'text' ){
 					if (myform.elements[i].id) {
-						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].value);
+						var elementId = String(myform.elements[i].id).replace(/mb_digitize_form_/, "");
+						d.get(m).e.setElement(elementId, myform.elements[i].value);
 					}
 					else {
 						errorMessage = msgObj.messageErrorFormEvaluation;
@@ -1402,7 +1403,8 @@
 				// selectbox
 				else if (typeof(myform.elements[i].selectedIndex) == 'number') {
 					if (myform.elements[i].id) {
-						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].options[myform.elements[i].selectedIndex].value);
+						var elementId = String(myform.elements[i].id).replace(/mb_digitize_form_/, "");
+						d.get(m).e.setElement(elementId, myform.elements[i].options[myform.elements[i].selectedIndex].value);
 					}
 					else {
 						errorMessage = msgObj.messageErrorFormEvaluation;



More information about the Mapbender_commits mailing list