server/src/main/webapp/WEB-INF/templates/fragment/spaceForm.html
branchuser_management
changeset 225 0fcce86e650c
parent 224 0167b777ad15
--- a/server/src/main/webapp/WEB-INF/templates/fragment/spaceForm.html	Mon Oct 21 17:55:12 2013 +0200
+++ b/server/src/main/webapp/WEB-INF/templates/fragment/spaceForm.html	Tue Oct 22 17:54:30 2013 +0200
@@ -10,28 +10,28 @@
     //<![CDATA[
 
         function spaceFormSubmit() {
+            return true;
+            var errors = {};
+            var valid = true;
 
-        	var errors = {};
-        	var valid = true;
-        	
-        	if(!$('#title').val()) {
-        		errors['title'] = /*[[#{renkan.error.title.empty}]]*/"renkan.error.title.empty";
-        		valid = false;
-        	}
+            if(!$('#title').val()) {
+                errors['title'] = /*[[#{renkan.error.title.empty}]]*/"renkan.error.title.empty";
+                valid = false;
+            }
             
-        	if($('#binConfig').val()) {
-        		
-        		var editor = ace.edit("binConfigDiv");
-        		var annotations = editor.getSession().getAnnotations();
-        		if(annotations.length>0) {
+            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;        			
-        		}
-        	}
+                    valid = false;
+                }
+            }
             
             showformErrors(errors);
-                        
+
             return valid;
         }
 
@@ -43,11 +43,11 @@
             }
             else {
                 $('.binConfigButton').removeAttr("disabled");
-            }        	
+            }
         }
-        
+
         $(function(){
-        	var tabSize = 2;
+            var tabSize = 2;
             var editor = ace.edit("binConfigDiv");
             editor.setTheme("ace/theme/xcode");
             editor.getSession().setMode("ace/mode/json");
@@ -55,23 +55,23 @@
             editor.getSession().setUseSoftTabs(true);
             _setBinConfigStatus(editor);
             editor.getSession().on('change', function(e) {
-            	$('#binConfig').val(editor.getValue());
+                $('#binConfig').val(editor.getValue());
             });
             editor.getSession().on('changeAnnotation', function() {
                 _setBinConfigStatus(editor);
             });
-            
+
             $('#binConfigFormatButton').click(function(){
-            	var jsonText = editor.getValue();
-            	try {
-					editor.setValue(formatJson(jsonText, tabSize),0);
-					editor.moveCursorTo(0,0);
-					editor.clearSelection();
-				} catch (e) {
-					//do nothing
-				}
+                var jsonText = editor.getValue();
+                try {
+                    editor.setValue(formatJson(jsonText, tabSize),0);
+                    editor.moveCursorTo(0,0);
+                    editor.clearSelection();
+                } catch (e) {
+                    //do nothing
+                }
             });
-            
+
             $('#binConfigCompactButton').click(function(){
                 var jsonText = editor.getValue();
                 try {
@@ -82,17 +82,22 @@
                     //do nothing
                 }
             });
-            
+
             $('#color').spectrum({
-            	showInput: true,
-            	showAlpha: true,
-            	showPalette: true,
-            	showInitial: true
+                showInput: true,
+                showAlpha: true,
+                showPalette: true,
+                showInitial: true
             });
+
+            $("#model-form").submit(function(e) {
+                return spaceFormSubmit();
+            });
+
         });
     //]]>
   </script>
-  <form action="#" th:object="${space}" th:action="@{/admin/spaces/save}" method="post" onsubmit="return spaceFormSubmit()">
+  <form action="#" th:object="${space}" th:action="@{/admin/spaces/save}" method="post" id="model-form">
      <fieldset class="form-fields">
        <input type="hidden" th:field="*{id}" th:if="*{id}" />
        <input type="hidden" th:field="*{binConfig}"/>