server/src/main/webapp/WEB-INF/templates/fragment/spaceForm.html
changeset 128 93a1fbe6a848
parent 127 906fed13c1e1
child 141 64af5273ac5e
--- a/server/src/main/webapp/WEB-INF/templates/fragment/spaceForm.html	Tue Apr 02 01:56:11 2013 +0200
+++ b/server/src/main/webapp/WEB-INF/templates/fragment/spaceForm.html	Tue Apr 02 14:05:56 2013 +0200
@@ -20,7 +20,7 @@
         }
               
         function spaceFormSubmit() {
-        	
+
         	var errors = {};
         	var valid = true;
         	
@@ -29,16 +29,16 @@
         		valid = false;
         	}
             
-            try
-            {
-               var json = JSON.parse($('#binConfig').val());
-            }
-            catch(e)
-            {
-               console.log(e);
-               errors['binConfigDiv'] = /*[[#{renkan.error.bin_config.json}]]*/"renkan.error.bin_config.json";
-               valid = false;
-            }
+        	if($('#binConfig').val()) {
+        		
+        		var editor = ace.edit("binConfigDiv");
+        		var annotations = editor.getSession().getAnnotations();
+        		if(annotations.length>0) {
+                    var error_message = /*[[#{renkan.error.bin_config.json}]]*/"renkan.error.bin_config.json";
+                    errors['binConfigDiv'] = error_message + ". "+ annotations[0].type + ": (" +(annotations[0].row+1)+","+annotations[0].column+") " + annotations[0].text; 
+        			valid = false;        			
+        		}
+        	}
             
             showformErrors(errors);