← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8767: mobile: validate that subject, text, and at least one recipient is present in new-message

 

------------------------------------------------------------
revno: 8767
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-30 12:17:23 +0100
message:
  mobile: validate that subject, text, and at least one recipient is present in new-message
modified:
  dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-25 13:41:53 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/new-message.vm	2012-10-30 11:17:23 +0000
@@ -207,6 +207,18 @@
         message.users = [];
         message.userGroups = [];
 
+        if( !message.subject.length > 0 ) {
+            $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Please fill in subject", true );
+            setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
+            return false;
+        }
+
+        if( !message.text.length > 0 ) {
+            $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Please fill in text", true );
+            setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
+            return false;
+        }
+
         $.mobile.showPageLoadingMsg();
 
         _(_(selected).keys()).each(function(key) {
@@ -224,6 +236,12 @@
             }
         });
 
+        if( !( message.organisationUnits.length > 0 || message.users.length > 0 || message.userGroups.length > 0 ) ) {
+            $.mobile.showPageLoadingMsg( $.mobile.pageLoadErrorMessageTheme, "Please add at least one recipient", true );
+            setTimeout( $.mobile.hidePageLoadingMsg, 1500 );
+            return false;
+        }
+
         $.ajax({
            url: "$baseUrl/../api/messageConversations",
            type: 'POST',