svn commit: r671424 - in /ofbiz/trunk/framework: example/webapp/example/WEB-INF/controller.xml images/webapp/images/selectall.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r671424 - in /ofbiz/trunk/framework: example/webapp/example/WEB-INF/controller.xml images/webapp/images/selectall.js

apatel-2
Author: apatel
Date: Tue Jun 24 21:47:10 2008
New Revision: 671424

URL: http://svn.apache.org/viewvc?rev=671424&view=rev
Log:
Initial version of code to show error messages when form is posted in background.

Modified:
    ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml
    ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml?rev=671424&r1=671423&r2=671424&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Tue Jun 24 21:47:10 2008
@@ -29,6 +29,7 @@
     <owner>Copyright 2001-2008 The Apache Software Foundation</owner>
 
     <handler name="groovy" type="request" class="org.ofbiz.webapp.event.GroovyEventHandler"/>
+    <handler name="jsonservice" type="request" class="org.ofbiz.webapp.event.JSONServiceEventHandler"/>
 
     <!--
       These can be used to return the reports as views; make sure the classes are compiled and available
@@ -72,9 +73,9 @@
     </request-map>
     <request-map uri="createExampleAjax">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createExample"/>
-        <response name="success" type="view" value="findExampleAjax"/>
-        <response name="error" type="view" value="findExampleAjax"/>
+        <event type="jsonservice" invoke="createExample"/>
+        <response name="success" type="none" value="findExampleAjax"/>
+        <response name="error" type="none" value="findExampleAjax"/>
     </request-map>
     <request-map uri="updateExampleAjax">
         <security https="true" auth="true"/>

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=671424&r1=671423&r2=671424&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Tue Jun 24 21:47:10 2008
@@ -284,8 +284,25 @@
 function ajaxSubmitFormUpdateAreas(form, areaCsvString) {
     submitFormDisableSubmits($(form));
     updateFunction = function(transport) {
-     $(form).reset();
-        ajaxUpdateAreas(areaCsvString);
+        var data = transport.responseText.evalJSON(true);
+        if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) {
+            if(!$('content-messages')) {
+               //add this div just after app-navigation
+               if($('app-navigation')){
+                   $('app-navigation' ).insert({after: '<div id="content-messages"></div>'});
+               }
+            }
+           $('content-messages').addClassName('errorMessage');
+           $('content-messages' ).update(data._ERROR_MESSAGE_LIST_ + " " + data._ERROR_MESSAGE_);
+           new Effect.Appear('content-messages',{duration: 0.5});
+        }else {
+         if($('content-messages')) {
+                $('content-messages').removeClassName('errorMessage');
+                new Effect.Fade('content-messages',{duration: 0.0});  
+            }
+            $(form).reset();
+            ajaxUpdateAreas(areaCsvString);
+        }
     }
     new Ajax.Request($(form).action, {
         parameters: $(form).serialize(true),