← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18938: replace valueType/type of attribute/dataElement with property optionSetValue

 

------------------------------------------------------------
revno: 18938
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-17 15:14:21 +0200
message:
  replace valueType/type of attribute/dataElement with property optionSetValue
modified:
  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/event-capture.js
  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-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js


--
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/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-03-30 10:40:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-04-17 13:14:21 +0000
@@ -271,7 +271,7 @@
                                                 val = new Number(val);
                                             }                                
                                         }
-                                        if($scope.prStDes[dataValue.dataElement].dataElement.type === 'string'){                                            
+                                        if($scope.prStDes[dataValue.dataElement].dataElement.optionSetValue){                                            
                                             if($scope.prStDes[dataValue.dataElement].dataElement.optionSet &&
                                                     $scope.prStDes[dataValue.dataElement].dataElement.optionSet.id &&
                                                     $scope.optionSets[$scope.prStDes[dataValue.dataElement].dataElement.optionSet.id] &&
@@ -502,7 +502,7 @@
             var val = $scope.currentEvent[dataElement];
             if(val){
                 valueExists = true;            
-                if($scope.prStDes[dataElement].dataElement.type === 'string'){
+                if($scope.prStDes[dataElement].dataElement.optionSetValue){
                     if($scope.prStDes[dataElement].dataElement.optionSet){                        
                         val = OptionSetService.getCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options,val);
                     }
@@ -626,7 +626,7 @@
         for(var dataElement in $scope.prStDes){
             var val = $scope.currentEvent[dataElement];
             
-            if(val && $scope.prStDes[dataElement].dataElement.type === 'string'){
+            if(val && $scope.prStDes[dataElement].dataElement.optionSetValue){
                 if($scope.prStDes[dataElement].dataElement.optionSet){                    
                     val = OptionSetService.getCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options,val); 
                 }    
@@ -707,7 +707,7 @@
                 
         if( newValue != oldValue ){
             
-            if($scope.prStDes[dataElement].dataElement.type === 'string'){
+            if($scope.prStDes[dataElement].dataElement.optionSetValue){
                 if($scope.prStDes[dataElement].dataElement.optionSet){
                     newValue = OptionSetService.getCode($scope.optionSets[$scope.prStDes[dataElement].dataElement.optionSet.id].options, newValue);
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js	2015-03-30 10:40:41 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js	2015-04-17 13:14:21 +0000
@@ -390,7 +390,7 @@
 {
     return function() {
         return $.ajax( {
-            url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,type,numberType,formName,optionSet[id]]]',
+            url: '../api/programStages.json?filter=id:eq:' + id +'&fields=id,name,version,description,reportDateDescription,captureCoordinates,dataEntryForm,minDaysFromStart,repeatable,preGenerateUID,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,sortOrder,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,name,type,optionSetValue,numberType,formName,optionSet[id]]]',
             type: 'GET'
         }).done( function( response ){            
             _.each( _.values( response.programStages ), function( programStage ) {                

=== 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	2015-03-04 12:38:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-04-17 13:14:21 +0000
@@ -73,7 +73,41 @@
                 </td>
                 <td >
                     <ng-form name="innerForm">
-                        <div ng-switch="eventGridColumn.type">
+                        <div ng-if="prStDes[eventGridColumn.id].dataElement.optionSetValue">
+                            <span ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length >= 7">
+                                <input type="text"
+                                       class="typeahead"
+                                       placeholder="&#xf0d7;&nbsp;&nbsp;"                                                 
+                                       ng-model="currentEvent[eventGridColumn.id]"                                                                    
+                                       typeahead="option.name as option.name for option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" 
+                                       typeahead-open-on-focus   
+                                       typeahead-editable=false
+                                       d2-typeahead-validation
+                                       ng-required={{eventGridColumn.compulsory}}
+                                       name="foo" 
+                                       input-field-id={{eventGridColumn.id}} 
+                                       style="width:99%;"/>
+                            </span>                                    
+                            <span ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7">                                    
+                                <label>
+                                    <input type="radio" 
+                                           name="foo"  
+                                           input-field-id={{eventGridColumn.id}}   
+                                           ng-required={{eventGridColumn.compulsory}}
+                                           ng-model="currentEvent[eventGridColumn.id]"
+                                           value=""> {{'no_value' | translate}}<br>
+                                </label>                                    
+                                <label ng-repeat="option in  optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options">
+                                    <input type="radio" 
+                                           name={{eventGridColumn.id}}   
+                                           input-field-id={{eventGridColumn.id}}    
+                                           ng-required={{eventGridColumn.compulsory}}
+                                           ng-model="currentEvent[eventGridColumn.id]"
+                                           value={{option.name}}> {{option.name}}<br>                                        
+                                </label>
+                            </span>
+                        </div>
+                        <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSetValue" ng-switch="eventGridColumn.type">
                             <div ng-switch-when="int">
                                 <input type="text"                                         
                                        d2-number-validation 
@@ -85,48 +119,12 @@
                                        style="width:99%;"/>
                             </div>
                             <div ng-switch-when="string">                                
-                                <div class="container-fluid" ng-if="prStDes[eventGridColumn.id].dataElement.optionSet">
-                                    <span ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length >= 7">
-                                        <input type="text"
-                                               class="typeahead"
-                                               placeholder="&#xf0d7;&nbsp;&nbsp;"                                                 
-                                               ng-model="currentEvent[eventGridColumn.id]"                                                                    
-                                               typeahead="option.name as option.name for option in optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" 
-                                               typeahead-open-on-focus   
-                                               typeahead-editable=false
-                                               d2-typeahead-validation
-                                               ng-required={{eventGridColumn.compulsory}}
-                                               name="foo" 
-                                               input-field-id={{eventGridColumn.id}} 
-                                               style="width:99%;"/>
-                                    </span>                                    
-                                    <span ng-if="selectedProgram.dataEntryMethod && optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length < 7">                                    
-                                        <label>
-                                            <input type="radio" 
-                                                   name="foo"  
-                                                   input-field-id={{eventGridColumn.id}}   
-                                                   ng-required={{eventGridColumn.compulsory}}
-                                                   ng-model="currentEvent[eventGridColumn.id]"
-                                                   value=""> {{'no_value' | translate}}<br>
-                                        </label>                                    
-                                        <label ng-repeat="option in  optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options">
-                                            <input type="radio" 
-                                                   name={{eventGridColumn.id}}   
-                                                   input-field-id={{eventGridColumn.id}}    
-                                                   ng-required={{eventGridColumn.compulsory}}
-                                                   ng-model="currentEvent[eventGridColumn.id]"
-                                                   value={{option.name}}> {{option.name}}<br>                                        
-                                        </label>
-                                    </span>
-                                </div>
-                                <div ng-if="!prStDes[eventGridColumn.id].dataElement.optionSet">
-                                    <input type="text"                                             
-                                        ng-model="currentEvent[eventGridColumn.id]"                                        
-                                        ng-required={{eventGridColumn.compulsory}}
-                                        name="foo" 
-                                        input-field-id={{eventGridColumn.id}} 
-                                        style="width:99%;"/>
-                                </div>                                
+                                <input type="text"                                             
+                                    ng-model="currentEvent[eventGridColumn.id]"                                        
+                                    ng-required={{eventGridColumn.compulsory}}
+                                    name="foo" 
+                                    input-field-id={{eventGridColumn.id}} 
+                                    style="width:99%;"/>                                
                             </div>
                             <div ng-switch-when="bool">
                                 <select ng-model="currentEvent[eventGridColumn.id]"                                                                

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-04-17 07:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-04-17 13:14:21 +0000
@@ -263,7 +263,7 @@
             if( prStDe ){                
                 var val = dataValue.value;
                 if(prStDe.dataElement){           
-                    if(val && prStDe.dataElement.type === 'string' && prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id].options  ){
+                    if(val && prStDe.dataElement.optionSetValue && $scope.optionSets[prStDe.dataElement.optionSet.id].options  ){
                         val = OptionSetService.getName($scope.optionSets[prStDe.dataElement.optionSet.id].options, val);
                     }
                     if(val && prStDe.dataElement.type === 'date'){
@@ -319,7 +319,7 @@
                 if(prStDe.dataElement.type === 'date'){                    
                     value = DateUtils.formatFromUserToApi(value);
                 }
-                if(prStDe.dataElement.type === 'string'){                    
+                if(prStDe.dataElement.optionSetValue){                    
                     if(prStDe.dataElement.optionSet && $scope.optionSets[prStDe.dataElement.optionSet.id] &&  $scope.optionSets[prStDe.dataElement.optionSet.id].options ) {
                         value = OptionSetService.getCode($scope.optionSets[prStDe.dataElement.optionSet.id].options, value);
                     }                    

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-03-25 08:50:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2015-04-17 13:14:21 +0000
@@ -19,7 +19,46 @@
             </td>
             <td class="col-md-5">
                 <ng-form name="dataEntryInnerForm">
-                    <div ng-switch="prStDe.dataElement.type">
+                    <div ng-if="prStDe.dataElement.optionSetValue">
+                        <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDe.dataElement.optionSet.id].options.length >= 7">
+                            <input type="text"
+                                ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
+                                ng-model="currentEvent[prStDe.dataElement.id]" 
+                                ng-required={{prStDe.compulsory}} 
+                                ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                typeahead="option.name as option.name for option in optionSets[prStDe.dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" 
+                                typeahead-open-on-focus 
+                                typeahead-editable="false"
+                                ng-blur="saveDatavalue(prStDe)" 
+                                name="foo"/>
+                            <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid || !currentEvent[prStDe.dataElement.id] && currentElement.id === prStDe.dataElement.id" class="error">{{'invalid'| translate}}</span>
+                        </div>
+                        <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDe.dataElement.optionSet.id].options.length < 7">
+                            <label>                                        
+                                <input type="radio"
+                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
+                                    name={{currentEvent[prStDe.dataElement.id]}}
+                                    ng-required={{prStDe.compulsory}} 
+                                    ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                    ng-model="currentEvent[prStDe.dataElement.id]"
+                                    ng-change="saveDatavalue(prStDe)" 
+                                    value=""> {{'no_value' | translate}}<br>                                       
+                            </label><br>
+                            <span ng-repeat="option in optionSets[prStDe.dataElement.optionSet.id].options">
+                                <label>
+                                    <input type="radio"
+                                        ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
+                                        name={{currentEvent[prStDe.dataElement.id]}}
+                                        ng-required={{prStDe.compulsory}} 
+                                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
+                                        ng-model="currentEvent[prStDe.dataElement.id]"
+                                        ng-change="saveDatavalue(prStDe)" 
+                                        value={{option.name}}> {{option.name}}
+                                </label><br>
+                            </span>
+                        </div> 
+                    </div>
+                    <div ng-if="!prStDe.dataElement.optionSetValue" ng-switch="prStDe.dataElement.type">
                         <div ng-switch-when="int">
                             <input type="text"
                                    ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
@@ -31,54 +70,13 @@
                             <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid" class="error">{{'number_required'| translate}}</span>
                         </div>                        
                         <div ng-switch-when="string">                            
-                            <div ng-if="prStDe.dataElement.optionSet">
-                                <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDe.dataElement.optionSet.id].options.length >= 7">
-                                    <input type="text"
-                                        ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
-                                        ng-model="currentEvent[prStDe.dataElement.id]" 
-                                        ng-required={{prStDe.compulsory}} 
-                                        ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
-                                        typeahead="option.name as option.name for option in optionSets[prStDe.dataElement.optionSet.id].options | filter:$viewValue | limitTo:20" 
-                                        typeahead-open-on-focus 
-                                        typeahead-editable="false"
-                                        ng-blur="saveDatavalue(prStDe)" 
-                                        name="foo"/>
-                                    <span ng-show="dataEntryOuterForm.submitted && dataEntryInnerForm.foo.$invalid || !currentEvent[prStDe.dataElement.id] && currentElement.id === prStDe.dataElement.id" class="error">{{'invalid'| translate}}</span>
-                                </div>
-                                <div ng-if="selectedProgram.dataEntryMethod && optionSets[prStDe.dataElement.optionSet.id].options.length < 7">
-                                    <label>                                        
-                                        <input type="radio"
-                                            ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
-                                            name={{currentEvent[prStDe.dataElement.id]}}
-                                            ng-required={{prStDe.compulsory}} 
-                                            ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
-                                            ng-model="currentEvent[prStDe.dataElement.id]"
-                                            ng-change="saveDatavalue(prStDe)" 
-                                            value=""> {{'no_value' | translate}}<br>                                       
-                                    </label><br>
-                                    <span ng-repeat="option in optionSets[prStDe.dataElement.optionSet.id].options">
-                                        <label>
-                                            <input type="radio"
-                                                ng-class='getInputNotifcationClass(prStDe.dataElement.id,true)'
-                                                name={{currentEvent[prStDe.dataElement.id]}}
-                                                ng-required={{prStDe.compulsory}} 
-                                                ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
-                                                ng-model="currentEvent[prStDe.dataElement.id]"
-                                                ng-change="saveDatavalue(prStDe)" 
-                                                value={{option.name}}> {{option.name}}
-                                        </label><br>
-                                    </span>
-                                </div>                                    
-                            </div>
-                            <div ng-if="!prStDe.dataElement.optionSet">
-                                <input type="text"
+                            <input type="text"
                                     ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'
                                     ng-model="currentEvent[prStDe.dataElement.id]" 
                                     ng-required={{prStDe.compulsory}} 
                                     ng-disabled="selectedEnrollment.status !== 'ACTIVE' || currentEvent.editingNotAllowed" 
                                     ng-blur="saveDatavalue(prStDe)" 
                                     name="foo"/>
-                            </div>
                         </div>
                         <div ng-switch-when="bool">
                             <select ng-class='getInputNotifcationClass(prStDe.dataElement.id,false)'

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-03-30 13:21:20 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2015-04-17 13:14:21 +0000
@@ -6,7 +6,16 @@
         </td>
         <td>
             <ng-form name="innerForm">
-                <span ng-switch="attribute.valueType">
+                <span ng-if="attribute.optionSetValue">
+                    <input type="text"
+                            name="foo"
+                            class="form-control"
+                            ng-model="selectedTei[attribute.id]"                                                 
+                            typeahead="option.name as option.name for option in optionSets[attributesById[attribute.id].optionSet.id].options | filter:$viewValue | limitTo:20" 
+                            typeahead-open-on-focus                                           
+                            ng-disabled="editingDisabled" ng-required="attribute.mandatory || attribute.unique"/>
+                </span>
+                <span ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType">
                     <span ng-switch-when="date">
                         <input type="text" 
                                placeholder="{{dhis2CalendarFormat.keyDateFormat}}" 
@@ -36,16 +45,7 @@
                             <option value="false">{{'no'| translate}}</option>
                             <option value="true">{{'yes'| translate}}</option>
                         </select>
-                    </span>
-                    <span ng-switch-when="optionSet">
-                        <input type="text"
-                               name="foo"
-                               class="form-control"
-                               ng-model="selectedTei[attribute.id]"                                                 
-                               typeahead="option.name as option.name for option in optionSets[attributesById[attribute.id].optionSet.id].options | filter:$viewValue | limitTo:20" 
-                               typeahead-open-on-focus                                           
-                               ng-disabled="editingDisabled" ng-required="attribute.mandatory || attribute.unique"/>
-                    </span>
+                    </span>                    
                     <span ng-switch-when="number">
                         <input type="text" 
                                name="foo" 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-04-14 12:20:55 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-04-17 13:14:21 +0000
@@ -601,7 +601,7 @@
                 if(attribute.valueType === 'date'){
                     val = DateUtils.formatFromUserToApi(val);
                 }
-                if(attribute.valueType === 'optionSet' &&
+                if(attribute.optionSetValue &&
                         attribute.optionSet &&
                         attribute.optionSet.id &&                
                         $scope.optionSets[attribute.optionSet.id] &&

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html	2015-04-09 10:18:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html	2015-04-17 13:14:21 +0000
@@ -37,7 +37,12 @@
                     {{attribute.name}}
                 </td>
                 <td>
-                    <div ng-switch="attribute.valueType">
+                    <div ng-if="attribute.optionSetValue">
+                        <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
+                            <option ng-repeat="option in attribute.optionSet.options" value="{{option.code}}">{{option.name}}</option>
+                        </select>
+                    </div>
+                    <div ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType">
                         <div ng-switch-when="number">
                             <div class="dataelement-filter">                                                
                                 <div class="filter-operator">
@@ -76,11 +81,6 @@
                                 </div>                            
                             </div> 
                         </div>                        
-                        <div ng-switch-when="optionSet">
-                            <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
-                                <option ng-repeat="option in attribute.optionSet.options" value="{{option.code}}">{{option.name}}</option>
-                            </select>
-                        </div>
                         <div ng-switch-when="bool">
                             <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
                                 <option ng-repeat="option in boolOperators" value="{{option}}">{{option| translate}}</option>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-04-15 11:15:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-04-17 13:14:21 +0000
@@ -650,7 +650,7 @@
         get: function(entityUid, optionSets, attributesById){
             var promise = $http.get( '../api/trackedEntityInstances/' +  entityUid + '.json').then(function(response){
                 var tei = response.data;
-                angular.forEach(tei.attributes, function(att){
+                angular.forEach(tei.attributes, function(att){                    
                     if(attributesById[att.attribute]){
                         att.displayName = attributesById[att.attribute].name;
                     }
@@ -891,8 +891,8 @@
                             val = DateUtils.formatFromUserToApi(val);
                         }                        
                     }
-                    if(type === 'optionSet' && 
-                            attsById[att.attribute] && 
+                    if(attsById[att.attribute] && 
+                            attsById[att.attribute].optionSetValue && 
                             attsById[att.attribute].optionSet && 
                             attsById[att.attribute].optionSet.id && 
                             optionSets[attsById[att.attribute].optionSet.id]){
@@ -1252,7 +1252,7 @@
                                 var val = row[i];
                                 
                                 if(attributes[grid.headers[i].name] && 
-                                        attributes[grid.headers[i].name].valueType === 'optionSet' && 
+                                        attributes[grid.headers[i].name].optionSetValue && 
                                         optionSets &&    
                                         attributes[grid.headers[i].name].optionSet &&
                                         optionSets[attributes[grid.headers[i].name].optionSet.id] ){
@@ -1507,7 +1507,7 @@
                 if(dhis2Event[prStDe.dataElement.id]){                    
                     var value = dhis2Event[prStDe.dataElement.id];
                     
-                    if( value && prStDe.dataElement.type === 'string' && prStDe.dataElement.optionSet && optionSets[prStDe.dataElement.optionSet.id]){
+                    if( value && prStDe.dataElement.optionSetValue && prStDe.dataElement.optionSet && optionSets[prStDe.dataElement.optionSet.id]){
                         value = OptionSetService.getCode(optionSets[prStDe.dataElement.optionSet.id].options, value);
                     }                    
                     if( value && prStDe.dataElement.type === 'date'){

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-04-15 09:04:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-04-17 13:14:21 +0000
@@ -407,7 +407,7 @@
         return $.ajax( {
             url: '../api/programStages.json',
             type: 'GET',
-            data: 'filter=id:eq:' + id +'&fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,formName,type,optionSet[id]]]'
+            data: 'filter=id:eq:' + id +'&fields=id,name,sortOrder,version,dataEntryForm,captureCoordinates,blockEntryForm,autoGenerateEvent,allowGenerateNextVisit,generatedByEnrollmentDate,remindCompleted,reportDateDescription,minDaysFromStart,repeatable,openAfterEnrollment,standardInterval,periodType,reportDateToUse,programStageSections[id,name,programStageDataElements[dataElement[id]]],programStageDataElements[displayInReports,allowProvidedElsewhere,allowFutureDate,compulsory,dataElement[id,code,name,formName,type,optionSetValue,optionSet[id]]]'
         }).done( function( response ){            
             _.each( _.values( response.programStages ), function( programStage ) {
                 dhis2.tc.store.set( 'programStages', programStage );
@@ -682,7 +682,7 @@
         return $.ajax( {
             url: '../api/trackedEntityAttributes.json',
             type: 'GET',
-            data: 'filter=id:eq:' + id +'&paging=false&fields=id,name,code,version,description,valueType,confidential,inherit,sortOrderInVisitSchedule,sortOrderInListNoProgram,displayOnVisitSchedule,displayInListNoProgram,unique,optionSet[id,version]'
+            data: 'filter=id:eq:' + id +'&paging=false&fields=id,name,code,version,description,valueType,optionSetValue,confidential,inherit,sortOrderInVisitSchedule,sortOrderInListNoProgram,displayOnVisitSchedule,displayInListNoProgram,unique,optionSet[id,version]'
         }).done( function( response ){            
             _.each( _.values( response.trackedEntityAttributes ), function( teAttribute ) {
                 dhis2.tc.store.set( 'attributes', teAttribute );

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html	2015-04-15 11:15:07 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html	2015-04-17 13:14:21 +0000
@@ -40,7 +40,12 @@
                     {{attribute.name}}
                 </td>
                 <td>
-                    <div ng-switch="attribute.valueType">
+                    <div ng-if="attribute.optionSetValue">
+                        <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
+                            <option ng-repeat="option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:100" value="{{option.code}}">{{option.name}}</option>
+                        </select>
+                    </div>
+                    <div ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType">
                         <div ng-switch-when="number">
                             <div class="dataelement-filter">                                                
                                 <div class="filter-operator">
@@ -78,11 +83,6 @@
                                     </div>
                                 </div>                            
                             </div> 
-                        </div>                        
-                        <div ng-switch-when="optionSet">
-                            <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
-                                <option ng-repeat="option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:100" value="{{option.code}}">{{option.name}}</option>
-                            </select>
                         </div>
                         <div ng-switch-when="bool">
                             <select ui-select2 multiple ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">

=== 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-04-17 07:19:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-04-17 13:14:21 +0000
@@ -251,25 +251,10 @@
                             
                             var prStDe = programStageDataElements[fieldId];
                             
-                            if( prStDe && prStDe.dataElement && prStDe.dataElement.type ){                            
-
-	                            //check data element type and generate corresponding angular input field
-	                            if(prStDe.dataElement.type === "int"){
-	                                newInputField = '<input type="text" ' +
-	                                                this.getAttributesAsString(attributes) +
-	                                                ' d2-validation ' +
-	                                                ' d2-number-validation ' +
-	                                                ' number-type="' + prStDe.dataElement.numberType + '" ' +
-	                                                ' ng-model="currentEvent.' + fieldId + '"' +
-	                                                ' input-field-id="' + fieldId + '"' +
-	                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-	                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
-	                                                ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' + 
-	                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">';
-	                            }
-	                            if(prStDe.dataElement.type === "string"){
-	                                if(prStDe.dataElement.optionSet){
-	                                    var optionSetId = prStDe.dataElement.optionSet.id;
+                            if( prStDe && prStDe.dataElement && prStDe.dataElement.type ){								
+								//check if dataelement has optionset								
+								if( prStDe.dataElement.optionSetValue){
+									var optionSetId = prStDe.dataElement.optionSet.id;
 	                                    newInputField = '<input type="text" ' +
 	                                                this.getAttributesAsString(attributes) +
 	                                                ' d2-validation ' +
@@ -285,9 +270,65 @@
 	                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +                                            
 	                                                ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' +
 	                                                ' typeahead-open-on-focus ng-required="prStDes.'+fieldId+'.compulsory"> ';
-	                                }
-	                                else{
-	                                    newInputField = '<input type="text" ' +
+								}
+								else{
+		                            //check data element type and generate corresponding angular input field
+		                            if(prStDe.dataElement.type === "int"){
+		                                newInputField = '<input type="text" ' +
+		                                                this.getAttributesAsString(attributes) +
+		                                                ' d2-validation ' +
+		                                                ' d2-number-validation ' +
+		                                                ' number-type="' + prStDe.dataElement.numberType + '" ' +
+		                                                ' ng-model="currentEvent.' + fieldId + '"' +
+		                                                ' input-field-id="' + fieldId + '"' +
+		                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+		                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
+		                                                ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' + 
+		                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">';
+		                            }		                            
+		                            else if(prStDe.dataElement.type === "bool"){
+		                                newInputField = '<select ' +
+		                                                this.getAttributesAsString(attributes) +
+		                                                ' d2-validation ' +
+		                                                ' ng-model="currentEvent.' + fieldId + '" ' +
+		                                                ' input-field-id="' + fieldId + '"' +
+		                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+		                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
+		                                                ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
+		                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">' + 
+		                                                '<option value="">{{\'please_select\'| translate}}</option>' +
+		                                                '<option value="false">{{\'no\'| translate}}</option>' + 
+		                                                '<option value="true">{{\'yes\'| translate}}</option>' +
+		                                                '</select> ';                                     
+		                            }
+		                            else if(prStDe.dataElement.type === "date"){
+		                                var maxDate = prStDe.allowFutureDate ? '' : 0;
+		                                newInputField = '<input type="text" ' +
+		                                                this.getAttributesAsString(attributes) +
+		                                                ' d2-validation ' +
+		                                                ' ng-model="currentEvent.' + fieldId + '"' +
+		                                                ' input-field-id="' + fieldId + '"' +                                                
+		                                                ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
+		                                                ' d2-date ' +
+		                                                ' max-date="' + maxDate + '"' +
+		                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+		                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
+		                                                ' blur-or-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
+		                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> '; 
+		                            }
+		                            else if(prStDe.dataElement.type.type === "trueOnly"){
+		                                newInputField = '<input type="checkbox" ' +
+		                                                this.getAttributesAsString(attributes) +
+		                                                ' d2-validation ' +
+		                                                ' ng-model="currentEvent.' + fieldId + '"' +
+		                                                ' input-field-id="' + fieldId + '"' +
+		                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
+		                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
+		                                                ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' +
+		                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> ';
+		                            }
+		                            else{
+		                                newInputField = '<input type="text" ' +
 	                                                this.getAttributesAsString(attributes) +
 	                                                ' d2-validation ' +
 	                                                ' ng-model="currentEvent.' + fieldId + '" ' +
@@ -295,50 +336,9 @@
 	                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent[uid]==\'uid\' || currentEvent.editingNotAllowed"' +
 	                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
 	                                                ' ng-blur="saveDatavalue(prStDes.'+ fieldId + ')"' +
-	                                                ' ng-required="prStDes.' + fieldId + '.compulsory"> ';                                     
-	                                }
-	                            }
-	                            if(prStDe.dataElement.type === "bool"){
-	                                newInputField = '<select ' +
-	                                                this.getAttributesAsString(attributes) +
-	                                                ' d2-validation ' +
-	                                                ' ng-model="currentEvent.' + fieldId + '" ' +
-	                                                ' input-field-id="' + fieldId + '"' +
-	                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-	                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
-	                                                ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
-	                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}">' + 
-	                                                '<option value="">{{\'please_select\'| translate}}</option>' +
-	                                                '<option value="false">{{\'no\'| translate}}</option>' + 
-	                                                '<option value="true">{{\'yes\'| translate}}</option>' +
-	                                                '</select> ';                                     
-	                            }
-	                            if(prStDe.dataElement.type === "date"){
-	                                var maxDate = prStDe.allowFutureDate ? '' : 0;
-	                                newInputField = '<input type="text" ' +
-	                                                this.getAttributesAsString(attributes) +
-	                                                ' d2-validation ' +
-	                                                ' ng-model="currentEvent.' + fieldId + '"' +
-	                                                ' input-field-id="' + fieldId + '"' +                                                
-	                                                ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
-	                                                ' d2-date ' +
-	                                                ' max-date="' + maxDate + '"' +
-	                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-	                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
-	                                                ' blur-or-change="saveDatavalue(prStDes.'+ fieldId + ')"' + 
-	                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> '; 
-	                            }
-	                            if(prStDe.dataElement.type.type === "trueOnly"){
-	                                newInputField = '<input type="checkbox" ' +
-	                                                this.getAttributesAsString(attributes) +
-	                                                ' d2-validation ' +
-	                                                ' ng-model="currentEvent.' + fieldId + '"' +
-	                                                ' input-field-id="' + fieldId + '"' +
-	                                                ' ng-class="getInputNotifcationClass(prStDes.' + fieldId + '.dataElement.id,true)"' +
-	                                                ' ng-disabled="selectedEnrollment.status===\'CANCELLED\' || selectedEnrollment.status===\'COMPLETED\' || currentEvent.editingNotAllowed"' +
-	                                                ' ng-change="saveDatavalue(prStDes.'+ fieldId + ')"' +
-	                                                ' ng-required="{{prStDes.' + fieldId + '.compulsory}}"> ';
-	                            }
+	                                                ' ng-required="prStDes.' + fieldId + '.compulsory"> ';
+		                            }		                            
+	                           	}
                            	}                            
                         }
 						
@@ -389,23 +389,9 @@
                         
                         var att = trackedEntityFormAttributes[attId];
                         
-                        if( att ){                       
-                        
-	                        //check attribute type and generate corresponding angular input field
-	                        if(att.valueType === "number"){
-	                            newInputField = '<input type="text" ' +
-	                                            ' name="' + fieldName + '"' +                          
-	                                            ' element-id="' + i + '"' +
-	                                            this.getAttributesAsString(attributes) +
-	                                            ' d2-validation ' +
-	                                            ' d2-number-validation ' +
-	                                            ' d2-focus-next-on-enter' + 
-	                                            ' ng-model="selectedTei.' + attId + '" ' +
-	                                            ' ng-disabled="editingDisabled"' +
-	                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
-	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
-	                        }                                               
-	                        else if(att.valueType === "optionSet"){
+                        if( att ){                        	
+                        	//check if attribute has optionset
+                        	if(att.optionSetValue){                        		
 	                            var optionSetId = att.optionSet.id;                            
 	                            newInputField = '<input type="text" ' +
 	                                            ' name="' + fieldName + '"' +
@@ -423,73 +409,90 @@
 	                                            ' typeahead-open-on-focus ' +
 	                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
 	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';                            
-	                        }
-	                        else if(att.valueType === "bool"){
-	                            newInputField = '<select ' +
-	                                            ' name="' + fieldName + '"' +
-	                                            ' element-id="' + i + '"' +
-	                                            this.getAttributesAsString(attributes) +
-	                                            ' d2-focus-next-on-enter' + 
-	                                            ' ng-model="selectedTei.' + attId + '" ' +
-	                                            ' ng-disabled="editingDisabled"' +
-	                                            ' ng-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
-	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ' +
-	                                            ' <option value="">{{\'please_select\'| translate}}</option>' +
-	                                            ' <option value="false">{{\'no\'| translate}}</option>' + 
-	                                            ' <option value="true">{{\'yes\'| translate}}</option>' +
-	                                            '</select> ';
-	                        }
-	                        else if(att.valueType === "date"){
-	                            newInputField = '<input type="text" ' +
-	                                            ' name="' + fieldName + '"' +
-	                                            ' element-id="' + i + '"' +
-	                                            this.getAttributesAsString(attributes) +
-	                                            ' d2-focus-next-on-enter' + 
-	                                            ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
-	                                            ' ng-model="selectedTei.' + attId + '" ' +
-	                                            ' ng-disabled="editingDisabled"' +
-	                                            ' max-date="' + attMaxDate + '"' + '\'' +
-	                                            ' d2-date' +
-	                                            ' d2-validation ' +
-	                                            ' blur-or-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
-	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
-	                        }
-	                        else if(att.valueType === "trueOnly"){
-	                            newInputField = '<input type="checkbox" ' +  
-	                                            ' name="' + fieldName + '"' +
-	                                            ' element-id="' + i + '"' +
-	                                            this.getAttributesAsString(attributes) + 
-	                                            ' d2-validation ' +
-	                                            ' d2-focus-next-on-enter' + 
-	                                            ' ng-model="selectedTei.' + attId + '" ' +
-	                                            ' ng-disabled="editingDisabled"' +
-	                                            ' ng-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
-	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
-	                        }
-	                        else if(att.valueType === "email"){
-	                            newInputField = '<input type="email" ' +    
-	                                            ' name="' + fieldName + '"' +                                              
-	                                            ' element-id="' + i + '"' +
-	                                            this.getAttributesAsString(attributes) +
-	                                            ' d2-validation ' +
-	                                            ' d2-focus-next-on-enter' + 
-	                                            ' ng-model="selectedTei.' + attId + '" ' +
-	                                            ' ng-disabled="editingDisabled"' +
-	                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
-	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
-	                        }
-	                        else {
-	                            newInputField = '<input type="text" ' +
-	                                            ' name="' + fieldName + '"' +
-	                                            ' element-id="' + i + '"' +                                             
-	                                            this.getAttributesAsString(attributes) +
-	                                            ' d2-validation ' +
-	                                            ' d2-focus-next-on-enter' + 
-	                                            ' ng-model="selectedTei.' + attId + '" ' +
-	                                            ' ng-disabled="editingDisabled"' +
-	                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
-	                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
-	                        }
+		                        
+                        	}
+                        	else{
+                        		//check attribute type and generate corresponding angular input field
+		                        if(att.valueType === "number"){
+		                            newInputField = '<input type="text" ' +
+		                                            ' name="' + fieldName + '"' +                          
+		                                            ' element-id="' + i + '"' +
+		                                            this.getAttributesAsString(attributes) +
+		                                            ' d2-validation ' +
+		                                            ' d2-number-validation ' +
+		                                            ' d2-focus-next-on-enter' + 
+		                                            ' ng-model="selectedTei.' + attId + '" ' +
+		                                            ' ng-disabled="editingDisabled"' +
+		                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+		                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
+		                        }		                        
+		                        else if(att.valueType === "bool"){
+		                            newInputField = '<select ' +
+		                                            ' name="' + fieldName + '"' +
+		                                            ' element-id="' + i + '"' +
+		                                            this.getAttributesAsString(attributes) +
+		                                            ' d2-focus-next-on-enter' + 
+		                                            ' ng-model="selectedTei.' + attId + '" ' +
+		                                            ' ng-disabled="editingDisabled"' +
+		                                            ' ng-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+		                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ' +
+		                                            ' <option value="">{{\'please_select\'| translate}}</option>' +
+		                                            ' <option value="false">{{\'no\'| translate}}</option>' + 
+		                                            ' <option value="true">{{\'yes\'| translate}}</option>' +
+		                                            '</select> ';
+		                        }
+		                        else if(att.valueType === "date"){
+		                            newInputField = '<input type="text" ' +
+		                                            ' name="' + fieldName + '"' +
+		                                            ' element-id="' + i + '"' +
+		                                            this.getAttributesAsString(attributes) +
+		                                            ' d2-focus-next-on-enter' + 
+		                                            ' placeholder="{{dhis2CalendarFormat.keyDateFormat}}" ' +
+		                                            ' ng-model="selectedTei.' + attId + '" ' +
+		                                            ' ng-disabled="editingDisabled"' +
+		                                            ' max-date="' + attMaxDate + '"' + '\'' +
+		                                            ' d2-date' +
+		                                            ' d2-validation ' +
+		                                            ' blur-or-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+		                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
+		                        }
+		                        else if(att.valueType === "trueOnly"){
+		                            newInputField = '<input type="checkbox" ' +  
+		                                            ' name="' + fieldName + '"' +
+		                                            ' element-id="' + i + '"' +
+		                                            this.getAttributesAsString(attributes) + 
+		                                            ' d2-validation ' +
+		                                            ' d2-focus-next-on-enter' + 
+		                                            ' ng-model="selectedTei.' + attId + '" ' +
+		                                            ' ng-disabled="editingDisabled"' +
+		                                            ' ng-change="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+		                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
+		                        }
+		                        else if(att.valueType === "email"){
+		                            newInputField = '<input type="email" ' +    
+		                                            ' name="' + fieldName + '"' +                                              
+		                                            ' element-id="' + i + '"' +
+		                                            this.getAttributesAsString(attributes) +
+		                                            ' d2-validation ' +
+		                                            ' d2-focus-next-on-enter' + 
+		                                            ' ng-model="selectedTei.' + attId + '" ' +
+		                                            ' ng-disabled="editingDisabled"' +
+		                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+		                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
+		                        }
+		                        else {
+		                            newInputField = '<input type="text" ' +
+		                                            ' name="' + fieldName + '"' +
+		                                            ' element-id="' + i + '"' +                                             
+		                                            this.getAttributesAsString(attributes) +
+		                                            ' d2-validation ' +
+		                                            ' d2-focus-next-on-enter' + 
+		                                            ' ng-model="selectedTei.' + attId + '" ' +
+		                                            ' ng-disabled="editingDisabled"' +
+		                                            ' ng-blur="validationAndSkipLogic(selectedTei,\'' + attId + '\')" ' +
+		                                            ' ng-required=" ' + (att.mandatory || att.unique) + '"> ';
+		                        }
+	                       	}
                        }
                          
                     }