=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2015-10-15 13:29:41 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties 2015-10-20 12:54:44 +0000 @@ -147,4 +147,5 @@ extend_menu=Extend menu show_main_menu=Show main menu close_editing=Close editing -fill_all_category_options=Please fill all category options \ No newline at end of file +fill_all_category_options=Please fill all category options +custom_form_has_invalid_dataelement=Custom form has invalid data element. \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-10-16 13:43:11 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties 2015-10-20 12:54:44 +0000 @@ -370,4 +370,6 @@ stick_right_widgets=Stick right side widgets unstick_right_widgets=Unstick right side widgets existing_associate=Existing associate -value_not_unique=Value not unique \ No newline at end of file +value_not_unique=Value not unique +custom_form_has_invalid_attribute=Custom form has invalid attribute. +custom_form_has_invalid_dataelement=Custom form has invalid data element. \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-10-15 14:05:49 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-10-20 12:54:44 +0000 @@ -308,7 +308,7 @@ }) /* service for dealing with custom form */ -.service('CustomFormService', function ($translate) { +.service('CustomFormService', function ($translate, DialogService) { return { getForProgramStage: function (programStage, programStageDataElements) { @@ -367,15 +367,16 @@ attributes['name'] = fieldId; } - var prStDe = programStageDataElements[fieldId]; - - var commonInputFieldProperty = this.getAttributesAsString(attributes) + - ' ng-model="currentEvent.' + fieldId + '" ' + - ' input-field-id="' + fieldId + '"' + - ' ng-disabled="isHidden(prStDes.' + fieldId + '.dataElement.id) || selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\' || currentEvent.editingNotAllowed"' + - ' ng-required="{{prStDes.' + fieldId + '.compulsory}}" '; + var prStDe = programStageDataElements[fieldId]; if (prStDe && prStDe.dataElement && prStDe.dataElement.valueType) { + + var commonInputFieldProperty = this.getAttributesAsString(attributes) + + ' ng-model="currentEvent.' + fieldId + '" ' + + ' input-field-id="' + fieldId + '"' + + ' ng-disabled="isHidden(prStDes.' + fieldId + '.dataElement.id) || selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\' || currentEvent.editingNotAllowed"' + + ' ng-required="{{prStDes.' + fieldId + '.compulsory}}" '; + //check if dataelement has optionset if (prStDe.dataElement.optionSetValue) { var optionSetId = prStDe.dataElement.optionSet.id; @@ -442,6 +443,14 @@ } } } + else{ + var dialogOptions = { + headerText: 'error', + bodyText: 'custom_form_has_invalid_dataelement' + }; + DialogService.showDialog({}, dialogOptions); + return; + } } newInputField = newInputField + ' '; @@ -481,18 +490,15 @@ attributes[this.nodeName] = this.value; }); - var attId = '', newInputField, programId; + var attId = '', fieldName = '', newInputField, programId; if (attributes.hasOwnProperty('attributeid')) { attId = attributes['attributeid']; - - var fieldName = attId; - var attMaxDate = trackedEntityFormAttributes[attId].allowFutureDate ? '' : 0; - - var att = trackedEntityFormAttributes[attId]; - var isTrackerAssociate = att.valueType === 'TRACKER_ASSOCIATE'; + fieldName = attId; + var att = trackedEntityFormAttributes[attId]; if (att) { - + var attMaxDate = att.allowFutureDate ? '' : 0; + var isTrackerAssociate = att.valueType === 'TRACKER_ASSOCIATE'; var commonInputFieldProperty = ' name="' + fieldName + '"' + ' element-id="' + i + '"' + this.getAttributesAsString(attributes) + @@ -575,7 +581,14 @@ } } } - + else{ + var dialogOptions = { + headerText: 'error', + bodyText: 'custom_form_has_invalid_attribute' + }; + DialogService.showDialog({}, dialogOptions); + return; + } } if (attributes.hasOwnProperty('programid')) {