← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17529: event capture form validation notification with value type

 

------------------------------------------------------------
revno: 17529
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-11-19 10:29:44 +0100
message:
  event capture form validation notification with value type
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/en.json
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html


--
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-apps/src/main/webapp/dhis-web-event-capture/i18n/en.json'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-11-16 10:31:19 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/en.json	2014-11-19 09:29:44 +0000
@@ -27,8 +27,12 @@
     "discard": "Discard",
     "back": "Back",
     "go_back": "Go back",
+    "form_invalid": "Form is invalid. Please check for required fields.",
     "required": "Required",
-    "number_required": "Number required",
+    "number_required": "Value must be number",
+    "text_required": "Value must be text",
+    "date_required": "Value must be date",
+    "option_required": "Value must be selected from drop-down",
     "ok": "Ok",
     "done": "Done",
     "remove": "Remove",

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-11-03 10:34:14 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2014-11-19 09:29:44 +0000
@@ -412,7 +412,7 @@
 
         //check for form validity
         $scope.outerForm.submitted = true;        
-        if( $scope.outerForm.$invalid ){            
+        if( $scope.outerForm.$invalid ){
             angular.forEach($scope.selectedProgramStage.programStageSections, function(section){
                 section.open = true;
             });

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-11-03 10:34:14 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2014-11-19 09:29:44 +0000
@@ -862,7 +862,7 @@
     clear: both
 }
 
-.horizonal-spacing{
+.horizontal-spacing{
     margin-right: 20px;    
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2014-11-04 02:32:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2014-11-19 09:29:44 +0000
@@ -32,7 +32,7 @@
                            ng-disabled="editingEventInFull"    
                            ng-required="true" 
                            name="eventDate"/>
-                    <span ng-show="outerForm.submitted && outerForm.eventDate.$invalid" class="required">{{'required'| translate}}</span>
+                    <span ng-show="outerForm.submitted && outerForm.eventDate.$invalid" class="required">{{'date_required'| translate}}</span>
                 </td>
             </tr>
             <tr ng-if="selectedProgramStage.captureCoordinates">
@@ -79,7 +79,8 @@
                                        ng-model="currentEvent[eventGridColumn.id]"                                                                
                                        ng-required={{eventGridColumn.compulsory}}
                                        name="foo" 
-                                       style="width:99%;"/>                                
+                                       style="width:99%;"/>
+                                <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'number_required'| translate}}</span>
                             </div>
                             <div ng-switch-when="string">                                
                                 <div class="container-fluid" ng-if="prStDes[eventGridColumn.id].dataElement.optionSet">
@@ -93,6 +94,7 @@
                                                name="foo" 
                                                style="width:99%;"/>
                                     </span>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'option_required'| translate}}</span>
                                     <span ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7">                                    
                                         <label>
                                             <input type="radio" 
@@ -116,6 +118,7 @@
                                         ng-required={{eventGridColumn.compulsory}}
                                         name="foo" 
                                         style="width:99%;"/>
+                                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'text_required'| translate}}</span>
                                 </div>                                
                             </div>
                             <div ng-switch-when="bool">
@@ -137,16 +140,17 @@
                                        ng-required={{eventGridColumn.compulsory}}
                                        name="foo" 
                                        style="width:99%;"/>
+                                <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'date_required'| translate}}</span>
                             </div>
                             <div ng-switch-when="trueOnly">
                                 <input type="checkbox"                                                                      
                                        ng-model="currentEvent[eventGridColumn.id]"                                                               
                                        ng-required={{eventGridColumn.compulsory}}
                                        name="foo"/>
+                                <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
                             </div>
                         </div>
-                    </ng-form>
-                    <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span>
+                    </ng-form>                    
                 </td>
             </tr>        
         </tbody>
@@ -360,6 +364,8 @@
         <button ng-disabled="disableSaveAndAddNew" ng-click="addEvent(true)" class="button not-printable">{{'save_and_add_new'| translate}}</button>
         <button ng-click="addEvent()" class="button not-printable">{{'save_and_back'| translate}}</button>
         <button ng-click="showEventList(null)" class="button not-printable">{{'go_back'| translate}}</button>
-    </span> 
+        <span ng-if="outerForm.submitted && outerForm.$invalid" class="horizontal-spacing red">{{'form_invalid' | translate}}</span>
+    </span>
+    
 </div>
 <!-- buttons for event registration / update ends -->
\ No newline at end of file