------------------------------------------------------------ revno: 17530 committer: Abyot Asalefew Gizaw <aby...@gmail.com> branch nick: dhis2 timestamp: Wed 2014-11-19 10:55:11 +0100 message: event capture - validation labels in custom/section forms 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/services.js dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/customForm.html 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-19 09:29:44 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/en.json 2014-11-19 09:55:11 +0000 @@ -29,10 +29,11 @@ "go_back": "Go back", "form_invalid": "Form is invalid. Please check for required fields.", "required": "Required", - "number_required": "Value must be number", - "text_required": "Value must be text", - "date_required": "Value must be date", + "int_required": "Value must be a number", + "string_required": "Value must be a text", + "date_required": "Value must be a date", "option_required": "Value must be selected from drop-down", + "bool_required": "Value must be a boolean", "ok": "Ok", "done": "Done", "remove": "Remove", === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-11-03 10:34:14 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js 2014-11-19 09:55:11 +0000 @@ -378,7 +378,8 @@ newInputField = '<input type="number" ' + this.getAttributesAsString(attributes) + ' ng-model="currentEvent.' + deId + '"' + - ' ng-required="prStDes.' + deId + '.compulsory">'; + ' ng-required="prStDes.' + deId + '.compulsory"> ' + + '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'int_required\'| translate}}</span>'; } if(programStageDataElements[deId].dataElement.type == "string"){ if(programStageDataElements[deId].dataElement.optionSet){ @@ -390,14 +391,16 @@ ' ng-required="prStDes.' + deId + '.compulsory"' + ' typeahead="option.name as option.name for option in optionSets.'+optionSetId+'.options | filter:$viewValue | limitTo:20"' + ' typeahead-editable="false" ' + - ' typeahead-open-on-focus ng-required="prStDes.'+deId+'.compulsory">'; + ' typeahead-open-on-focus ng-required="prStDes.'+deId+'.compulsory"> ' + + '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'option_required\'| translate}}</span>'; } else{ newInputField = '<input type="text" ' + this.getAttributesAsString(attributes) + ' ng-model="currentEvent.' + deId + '" ' + ' ng-disabled="currentEvent[uid] == \'uid\'" ' + - ' ng-required="prStDes.' + deId + '.compulsory">'; + ' ng-required="prStDes.' + deId + '.compulsory"> ' + + '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'text_required\'| translate}}</span>'; } } if(programStageDataElements[deId].dataElement.type == "bool"){ @@ -408,7 +411,8 @@ '<option value="">{{\'please_select\'| translate}}</option>' + '<option value="false">{{\'no\'| translate}}</option>' + '<option value="true">{{\'yes\'| translate}}</option>' + - '</select>'; + '</select> ' + + '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'bool_required\'| translate}}</span>'; } if(programStageDataElements[deId].dataElement.type == "date"){ newInputField = '<input type="text" ' + @@ -416,28 +420,22 @@ ' ng-model="currentEvent.' + deId + '"' + ' d2-date ' + ' max-date="' + maxDate + '"' + '\'' + - ' ng-required="prStDes.' + deId + '.compulsory">'; + ' ng-required="prStDes.' + deId + '.compulsory"> ' + + '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'date_required\'| translate}}</span>'; } if(programStageDataElements[deId].dataElement.type == "trueOnly"){ newInputField = '<input type="checkbox" ' + this.getAttributesAsString(attributes) + ' ng-model="currentEvent.' + deId + '"' + - ' ng-required="prStDes.' + deId + '.compulsory">'; + ' ng-required="prStDes.' + deId + '.compulsory"> ' + + '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'required\'| translate}}</span>'; } - newInputField = //'<ng-form name="innerForm">' + - newInputField + - '<span ng-show="outerForm.submitted && outerForm.'+ deId +'.$invalid" class="required">{{\'required\'| translate}}</span>'; - //'</ng-form>'; - htmlCode = htmlCode.replace(inputField, newInputField); } } - - return htmlCode; - + return htmlCode; } - return null; }, getAttributesAsString: function(attributes){ === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/customForm.html' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-11-04 02:32:10 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/customForm.html 2014-11-19 09:55:11 +0000 @@ -20,7 +20,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"> @@ -37,7 +37,7 @@ max="90" ng-required="false" style="min-width:128px"/> - <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'number_required'| translate}} [-90 ... 90]</span> + <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'int_required'| translate}} [-90 ... 90]</span> </span> <span class="coordinate-container"> <input type="number" @@ -48,7 +48,7 @@ max="180" ng-required="false" style="min-width:128px"/> - <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'number_required'| translate}}[-180 ... 180]</span> + <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'int_required'| translate}}[-180 ... 180]</span> </span> <!--<span class='pull-right'> <a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a> @@ -92,6 +92,7 @@ <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> + <span ng-if="outerForm.submitted && outerForm.$invalid" class="horizontal-spacing red">{{'form_invalid' | translate}}</span> </div> <!-- buttons for event registration / update ends --> \ No newline at end of file === 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-19 09:29:44 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2014-11-19 09:55:11 +0000 @@ -49,7 +49,7 @@ max="90" ng-required="false" style="min-width:128px"/> - <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'number_required'| translate}} [-90 ... 90]</span> + <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'int_required'| translate}} [-90 ... 90]</span> </span> <span class="coordinate-container"> <input type="number" @@ -60,7 +60,7 @@ max="180" ng-required="false" style="min-width:128px"/> - <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'number_required'| translate}}[-180 ... 180]</span> + <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'int_required'| translate}}[-180 ... 180]</span> </span> <!--<span class='pull-right'> <a href ng-click="showMap(currentEvent)" title="{{'get_from_map'| translate}}"><i class="fa fa-map-marker fa-2x"></i></a> @@ -80,7 +80,7 @@ ng-required={{eventGridColumn.compulsory}} name="foo" style="width:99%;"/> - <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'number_required'| translate}}</span> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'int_required'| translate}}</span> </div> <div ng-switch-when="string"> <div class="container-fluid" ng-if="prStDes[eventGridColumn.id].dataElement.optionSet"> @@ -93,8 +93,8 @@ ng-required={{eventGridColumn.compulsory}} name="foo" style="width:99%;"/> - </span> - <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'option_required'| translate}}</span> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'option_required'| translate}}</span> + </span> <span ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7"> <label> <input type="radio" @@ -110,6 +110,7 @@ ng-model="currentEvent[eventGridColumn.id]" value={{option.name}}> {{option.name}}<br> </label> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span> </span> </div> <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSet"> @@ -130,6 +131,7 @@ <option value="false">{{'no'| translate}}</option> <option value="true">{{'yes'| translate}}</option> </select> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'bool_required'| translate}}</span> </div> <div ng-switch-when="date"> <input type="text" @@ -191,7 +193,7 @@ ng-required="true" name="eventDate" style="width:99%;"> - <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"> @@ -206,7 +208,7 @@ max="90" ng-required="false" style="width:99%;"/> - <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'number_required'| translate}} [-90 ... 90]</span> + <span ng-show="outerForm.submitted && outerForm.latitude.$invalid" class="required">{{'int_required'| translate}} [-90 ... 90]</span> </td> </tr> <tr ng-if="selectedProgramStage.captureCoordinates"> @@ -221,7 +223,7 @@ max="180" ng-required="false" style="width:99%;"/> - <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'number_required'| translate}}[-180 ... 180]</span> + <span ng-show="outerForm.submitted && outerForm.longitude.$invalid" class="required">{{'int_required'| translate}}[-180 ... 180]</span> </td> </tr> </tbody> @@ -264,7 +266,8 @@ typeahead-editable="false" ng-required={{prStDes[de.dataElement.id].compulsory}} name="foo" - style="width:99%;"/> + style="width:99%;"/> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'option_required'| translate}}</span> </span> <span ng-if="selectedProgram.dataEntryMethod && prStDes[de.dataElement.id].dataElement.optionSet.options.length < 7"> <label> @@ -281,6 +284,7 @@ ng-model="currentEvent[de.dataElement.id]" value={{option.name}}> {{option.name}}<br> </label> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'required'| translate}}</span> </span> </div> <div ng-if="!prStDes[de.dataElement.id].dataElement.optionSet"> @@ -289,6 +293,7 @@ ng-required={{prStDes[de.dataElement.id].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"> @@ -300,6 +305,7 @@ <option value="false">{{'no'| translate}}</option> <option value="true">{{'yes'| translate}}</option> </select> + <span ng-show="outerForm.submitted && innerForm.foo.$invalid" class="required">{{'bool_required'| translate}}</span> </div> <div ng-switch-when="date"> <input type="text" @@ -310,16 +316,17 @@ ng-required={{prStDes[de.dataElement.id].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[de.dataElement.id]" ng-required={{prStDes[de.dataElement.id].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> @@ -363,9 +370,9 @@ <span ng-if="eventRegistration"> <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 ng-if="outerForm.submitted && outerForm.$invalid" class="horizontal-spacing red">{{'form_invalid' | translate}}</span> + <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> </div> <!-- buttons for event registration / update ends --> \ No newline at end of file
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp