← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10470: Upgrade case entry forms to use uids instead of (database) ids.

 

------------------------------------------------------------
revno: 10470
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-04 12:07:53 +0700
message:
  Upgrade case entry forms to use uids instead of (database) ids.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2013-04-02 08:24:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2013-04-04 05:07:53 +0000
@@ -529,8 +529,8 @@
                 // Get data element ID of data element
                 // -------------------------------------------------------------
 
-                int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
-                DataElement dataElement = dataElementService.getDataElement( dataElementId );
+                String dataElementUid = identifierMatcher.group( 2 );
+                DataElement dataElement = dataElementService.getDataElement( dataElementUid );
 
                 inputHTML = populateCustomDataEntryForTextBox( dataElement, inputHTML );
 
@@ -575,7 +575,7 @@
     private String populateCustomDataEntryForBoolean( DataElement dataElement, String inputHTML,
         String patientDataValue, I18n i18n )
     {
-        final String jsCodeForBoolean = " name=\"entryselect\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME' }\" onchange=\"saveOpt( $DATAELEMENTID )\" ";
+        final String jsCodeForBoolean = " name=\"entryselect\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME' }\" onchange=\"saveOpt( '$DATAELEMENTID' )\" ";
 
         inputHTML = inputHTML.replaceFirst( "input", "select" );
         inputHTML = inputHTML.replace( "name=\"entryselect\"", jsCodeForBoolean );
@@ -611,7 +611,7 @@
     private String populateCustomDataEntryForTrueOnly( DataElement dataElement, String inputHTML,
         String dataElementValue )
     {
-        final String jsCodeForInputs = " name=\"entryfield\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE'}\" onchange=\"saveVal( $DATAELEMENTID )\" onkeypress=\"return keyPress(event, this)\" ";
+        final String jsCodeForInputs = " name=\"entryfield\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE'}\" onchange=\"saveVal( '$DATAELEMENTID' )\" onkeypress=\"return keyPress(event, this)\" ";
 
         String checked = "";
         if ( !dataElementValue.equals( EMPTY ) && dataElementValue.equals( "true" ) )
@@ -637,7 +637,7 @@
     private String populateCustomDataEntryForTextBox( DataElement dataElement, String inputHTML, String dataElementValue )
     {
         final String jsCodeForInputs = " name=\"entryfield\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE'}\" options='$OPTIONS' maxlength=255 ";
-        final String jsCodeForOnchange = " name=\"entryfield\" tabIndex=\"$TABINDEX\" onchange=\"saveVal( $DATAELEMENTID )\" onkeypress=\"return keyPress(event, this)\" maxlength=255 ";
+        final String jsCodeForOnchange = " name=\"entryfield\" tabIndex=\"$TABINDEX\" onchange=\"saveVal( '$DATAELEMENTID' )\" onkeypress=\"return keyPress(event, this)\" maxlength=255 ";
 
         // -------------------------------------------------------------
         // Insert value of data element in output code
@@ -672,7 +672,7 @@
 
     private String populateCustomDataEntryForDate( String inputHTML, String dataElementValue )
     {
-        final String jsCodeForDate = " name=\"entryfield\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME'}\" onchange=\"saveVal( $DATAELEMENTID )\" ";
+        final String jsCodeForDate = " name=\"entryfield\" tabIndex=\"$TABINDEX\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME'}\" onchange=\"saveVal( '$DATAELEMENTID' )\" ";
 
         // -------------------------------------------------------------
         // Insert value of data element in output code

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2013-02-13 03:00:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2013-04-04 05:07:53 +0000
@@ -93,11 +93,11 @@
         this.value = value;
     }
 
-    private int dataElementId;
-
-    public void setDataElementId( int dataElementId )
+    private String dataElementUid;
+    
+    public void setDataElementUid( String dataElementUid )
     {
-        this.dataElementId = dataElementId;
+        this.dataElementUid = dataElementUid;
     }
 
     private Integer programStageInstanceId;
@@ -107,11 +107,6 @@
         this.programStageInstanceId = programStageInstanceId;
     }
 
-    public int getDataElementId()
-    {
-        return dataElementId;
-    }
-
     private int statusCode;
 
     public int getStatusCode()
@@ -135,7 +130,7 @@
     {
         ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
 
-        DataElement dataElement = dataElementService.getDataElement( dataElementId );
+        DataElement dataElement = dataElementService.getDataElement( dataElementUid );
 
         PatientDataValue patientDataValue = patientDataValueService.getPatientDataValue( programStageInstance,
             dataElement );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java	2013-03-07 16:01:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValuesAction.java	2013-04-04 05:07:53 +0000
@@ -192,11 +192,11 @@
         Collection<ProgramStageDataElement> psDataElements = programStage.getProgramStageDataElements();
         for ( ProgramStageDataElement psDataElement : psDataElements )
         {
-            String dataElementFieldId = programStage.getId() + "-" + psDataElement.getDataElement().getId() + "-val";
+            String dataElementFieldId = programStage.getUid() + "-" + psDataElement.getDataElement().getUid() + "-val";
             String value = request.getParameter( dataElementFieldId );
             if ( value != null && value.trim().length() > 0 )
             {
-                String providedElsewhereId = programStage.getId() + "_" + psDataElement.getDataElement().getId()
+                String providedElsewhereId = programStage.getUid() + "_" + psDataElement.getDataElement().getUid()
                     + "_facility";
                 boolean providedElsewhere = (request.getParameter( providedElsewhereId ) == null) ? false : true;
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2013-03-14 07:36:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/addSingleEventRegistration.vm	2013-04-04 05:07:53 +0000
@@ -48,7 +48,7 @@
 			#parse( "/dhis-web-caseentry/patientForm.vm" )
 		</tbody>
 		<tbody>
-			#parse( "/dhis-web-caseentry/singleDataEntryForm.vm" )
+			#parse( "/dhis-web-caseentry/dataEntryForm.vm" )
 		</tbody>
 		<tr>
 			<td></td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-03-06 03:50:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-04-04 05:07:53 +0000
@@ -24,7 +24,7 @@
 <input type='hidden' name='irregular' id='irregular' value='$!programStageInstance.programStage.irregular'>
 <input type='hidden' name='displayGenerateEventBox' id='displayGenerateEventBox' value='$!programStageInstance.programStage.displayGenerateEventBox'>
 <input type='hidden' name='completed' id='completed' value='$!programStageInstance.completed'>
-<input type='hidden' name='programStageId' id='programStageId' value='$!programStageInstance.programStage.id'>
+<input type='hidden' name='programStageUid' id='programStageUid' value='$!programStageInstance.programStage.uid'>
 <input type='hidden' name='programId' id='programId' value='$!programStageInstance.programInstance.program.id'>
 <input type='hidden' name='validCompleteOnly' id='validCompleteOnly' value='$!programStageInstance.programStage.validCompleteOnly'>
 <input type='hidden' name='currentUsername' id='currentUsername' value='$!currentUsername'>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm	2013-04-03 15:46:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm	2013-04-04 05:07:53 +0000
@@ -1,6 +1,7 @@
 <table id="defaultEntryScreenContainer" class='entryScreen formSection'>
 	<colgroup>
 		<col id="deCol">
+		<col id="deCol">
 		<col id="entryCol">
 		#if( $!programStageInstance.programStage.program.displayProvidedOtherFacility=='true')
 		<col width="5%" />
@@ -37,44 +38,44 @@
 		</td>        
 		##entry        
 		<td class='input-column'>   
-			#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+			#set( $id = $programStageDataElement.programStage.uid + '-' + $programStageDataElement.dataElement.uid + '-val' )
 			#if( $!programStageDataElement.dataElement.optionSet )
 				#set( $hasOptionSet = 'true')
 			#else
 				#set( $hasOptionSet = 'false')
 			#end
 			#if( $programStageDataElement.dataElement.textType == "longText" )
-				<textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
+				<textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( '$programStageDataElement.dataElement.uid' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
 			#elseif( $programStageDataElement.dataElement.type == "bool" )
-				<select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
+				<select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( '$programStageDataElement.dataElement.uid' )" tabindex="$tabIndex">
 					<option value="">[$i18n.getString( "select_value" )]</option>
 					<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
 					<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
 				</select>
 			#elseif( $programStageDataElement.dataElement.type == "trueOnly" )
-				<input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+				<input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( '$programStageDataElement.dataElement.uid' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
 			#elseif( $programStageDataElement.dataElement.type == "date" )
-				<input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()' }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="date-field datefield" />
+				<input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()' }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( '$programStageDataElement.dataElement.uid' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="date-field datefield" />
 				<script type="text/javascript">
-					datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false, false);
+					datePicker('$programStageDataElement.programStage.uid' + '-' + '$programStageDataElement.dataElement.uid' + '-val', false, false);
 				</script> 
 			#elseif($hasOptionSet=='true')
-				<input name="entryfield" options='$hasOptionSet' dataElementId='$programStageDataElement.dataElement.id' uid='$programStageDataElement.dataElement.uid' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="auto-field optionset" />
+				<input name="entryfield" options='$hasOptionSet' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="auto-field optionset" />
 			#elseif($programStageDataElement.dataElement.type=='username')
-				<input name="entryfield" username='true' class="auto-field optionset" dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
+				<input name="entryfield" username='true' class="auto-field optionset" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
 			#else
-				<input name="entryfield" dataElementId='$programStageDataElement.dataElement.id' 
+				<input name="entryfield"  
 					data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
 					id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" 
-					onchange="saveVal( $programStageDataElement.dataElement.id )" 
+					onchange="saveVal( '$programStageDataElement.dataElement.uid' )" 
 					onkeypress="return keyPress(event, this)" tabindex="$tabIndex"/>
 			#end
 		</td> 
 		#if( $programStage.program.displayProvidedOtherFacility=='true' )
 		<td style='width:20px;' align='center'>
-			#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-facility' )
+			#set( $id = $programStageDataElement.programStage.uid + '-' + $programStageDataElement.dataElement.uid + '-facility' )
 			#if( $programStageDataElement.allowProvidedElsewhere == 'true')
-			<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
+			<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( '$programStageDataElement.dataElement.uid', this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
 			#end
 		</td>
 		#end

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-04-03 15:46:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-04-04 05:07:53 +0000
@@ -3,22 +3,21 @@
 // Save value
 //------------------------------------------------------------------------------
 
-function saveVal( dataElementId )
+function saveVal( dataElementUid )
 {
-
-	var programStageId = jQuery('.stage-object-selected').attr('psid');
-	if(programStageId==undefined){
-		if( jQuery('#entryFormContainer [id=programStageId]') == null) return;
-		else programStageId = jQuery('#entryFormContainer [id=programStageId]').val();
+	var programStageUid = jQuery('.stage-object-selected').attr('psuid');
+	if(programStageUid==undefined){
+		if( jQuery('#entryFormContainer [id=programStageUid]') == null) return;
+		else programStageUid = jQuery('#entryFormContainer [id=programStageUid]').val();
 	}
-        
-	var fieldId = programStageId + '-' + dataElementId + '-val';
+    
+	var fieldId = programStageUid + '-' + dataElementUid + '-val';
 	
 	var field = byId( fieldId ); 
 	if( field == null) return;
 	
 	var fieldValue = jQuery.trim( field.value );
-
+	
 	var arrData = jQuery( "#" + fieldId ).attr('data').replace('{','').replace('}','').replace(/'/g,"").split(',');
 	var data = new Array();
 	for( var i in arrData )
@@ -87,26 +86,26 @@
 		else 
 			fieldValue="";
 	}
-	var valueSaver = new ValueSaver( dataElementId, fieldValue, type, SUCCESS_COLOR );
+	var valueSaver = new ValueSaver( dataElementUid, fieldValue, type, SUCCESS_COLOR );
     valueSaver.save();
 }
 
-function saveOpt( dataElementId )
+function saveOpt( dataElementUid )
 {
-	var programStageId = jQuery('.stage-object-selected').attr('psid');
-	var field = byId( programStageId + '-' + dataElementId + '-val' );	
+	var programStageUid = jQuery('.stage-object-selected').attr('psuid');
+	var field = byId( programStageUid + '-' + dataElementUid + '-val' );	
 	field.style.backgroundColor = SAVING_COLOR;
 	
-	var valueSaver = new ValueSaver( dataElementId, field.options[field.selectedIndex].value, 'bool', SUCCESS_COLOR );
+	var valueSaver = new ValueSaver( dataElementUid, field.options[field.selectedIndex].value, 'bool', SUCCESS_COLOR );
     valueSaver.save();
 }
 
-function updateProvidingFacility( dataElementId, checkField )
+function updateProvidingFacility( dataElementUid, checkField )
 {
-	var programStageId = byId( 'programStageId' ).value;
+	var programStageUid = byId( 'programStageUid' ).value;
 	var checked= checkField.checked;
 
-    var facilitySaver = new FacilitySaver( dataElementId, checked, SUCCESS_COLOR );
+    var facilitySaver = new FacilitySaver( dataElementUid, checked, SUCCESS_COLOR );
     facilitySaver.save();    
 }
 
@@ -134,7 +133,7 @@
     //Retrieve the data element id from the id of the field
     var str = e.target.id;
 	
-    var match = /.*\[(.*)\]/.exec( str ); //value[-dataElementId-]
+    var match = /.*\[(.*)\]/.exec( str ); //value[-dataElementUid-]
 	
     if ( ! match )
     {
@@ -213,15 +212,15 @@
 
 function ValueSaver( dataElementId_, value_, dataElementType_, resultColor_  )
 {
-    var dataElementId = dataElementId_;
-	var providedElsewhereId = getFieldValue('programStageId') + "-" + dataElementId_ + "-facility";
+    var dataElementUid = dataElementId_;
+	var providedElsewhereId = getFieldValue('programStageUid') + "-" + dataElementId_ + "-facility";
 	var value = value_;
 	var type = dataElementType_;
     var resultColor = resultColor_;
 	
     this.save = function()
     {
-		var params  = 'dataElementId=' + dataElementId;
+		var params  = 'dataElementUid=' + dataElementUid;
 			params += '&programStageInstanceId=' + getFieldValue('programStageInstanceId');
 		
 		params += '&providedElsewhere=';
@@ -276,21 +275,21 @@
  
     function markValue( color )
     {
-		var programStageId = jQuery('#entryFormContainer [id=programStageId]').val();
-		var element = byId( programStageId + "-" + dataElementId + '-val' );
+		var programStageUid = jQuery('#entryFormContainer [id=programStageUid]').val();
+		var element = byId( programStageUid + "-" + dataElementUid + '-val' );
         element.style.backgroundColor = color;
     }
 }
 
 function FacilitySaver( dataElementId_, providedElsewhere_, resultColor_ )
 {
-    var dataElementId = dataElementId_;
+    var dataElementUid = dataElementId_;
 	var providedElsewhere = providedElsewhere_;
     var resultColor = resultColor_;
 
     this.save = function()
     {
-		var params  = 'dataElementId=' + dataElementId;
+		var params  = 'dataElementUid=' + dataElementUid;
 			params += '&providedElsewhere=' + providedElsewhere ;
 		$.ajax({
 			   type: "POST",
@@ -351,7 +350,7 @@
 					box.css('background-color', COLOR_LIGHT_LIGHTRED);
 					disableCompletedButton(false);
 					enable('validationBtn');
-					setFieldValue( 'programStageId', selectedProgramStageInstance.attr('psid') );
+					setFieldValue( 'programStageUid', selectedProgramStageInstance.attr('psid') );
 					
 					var fieldId = "value_" + programStageInstanceId + "_date";
 					jQuery("#" + fieldId).val(executionDate);
@@ -510,8 +509,8 @@
 					var programInstanceId = jQuery('#entryFormContainer [id=programInstanceId]').val();
 					if( irregular == 'true' && displayGenerateEventBox=="true" )
 					{
-						var programStageId = jQuery(".stage-object-selected").attr('psid');
-						showCreateNewEvent( programInstanceId, programStageId );
+						var programStageUid = jQuery(".stage-object-selected").attr('psid');
+						showCreateNewEvent( programInstanceId, programStageUid );
 					}
 					
 					var selectedProgram = jQuery('.stage-object-selected');
@@ -689,8 +688,7 @@
 {
 	var input = jQuery( "#" +  idField );
 	input.parent().width( input.width() + 50 );
-	var dataElementId = input.attr('id').split('-')[1];
-	var dataElementUid = input.attr('uid');
+	var dataElementUid = input.attr('id').split('-')[1];
 	
 	input.autocomplete({
 		delay: 0,
@@ -714,14 +712,14 @@
 		select: function( event, ui ) {
 			var fieldValue = ui.item.value;
 			
-			if ( !dhis2.trigger.invoke( "caseentry-value-selected", [dataElementId, fieldValue] ) ) {
+			if ( !dhis2.trigger.invoke( "caseentry-value-selected", [dataElementUid, fieldValue] ) ) {
 				input.val( "" );
 				return false;
 			}
 			
 			input.val( fieldValue );			
 			if ( !unSave ) {
-				saveVal( dataElementId );
+				saveVal( dataElementUid );
 			}
 			input.autocomplete( "close" );
 		},
@@ -732,7 +730,7 @@
 				if ( !valid ) {
 					$( this ).val( "" );
 					if(!unSave)
-						saveVal( dataElementId );
+						saveVal( dataElementUid );
 					input.data( "autocomplete" ).term = "";
 					return false;
 				}
@@ -778,7 +776,7 @@
 {
 	var input = jQuery( "#" +  idField );
 	input.parent().width( input.width() + 50 );
-	var dataElementId = input.attr('id').split('-')[1];
+	var dataElementUid = input.attr('id').split('-')[1];
 	
 	input.autocomplete({
 		delay: 0,
@@ -802,14 +800,14 @@
 		select: function( event, ui ) {
 			var fieldValue = ui.item.value;
 			
-			if ( !dhis2.trigger.invoke( "caseentry-value-selected", [dataElementId, fieldValue] ) ) {
+			if ( !dhis2.trigger.invoke( "caseentry-value-selected", [dataElementUid, fieldValue] ) ) {
 				input.val( "" );
 				return false;
 			}
 			
 			input.val( fieldValue );			
 			if ( !unSave ) {
-				saveVal( dataElementId );
+				saveVal( dataElementUid );
 			}
 			input.autocomplete( "close" );
 		},
@@ -820,7 +818,7 @@
 				if ( !valid ) {
 					$( this ).val( "" );
 					if(!unSave)
-						saveVal( dataElementId );
+						saveVal( dataElementUid );
 					input.data( "autocomplete" ).term = "";
 					return false;
 				}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-03-06 04:14:33 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2013-04-04 05:07:53 +0000
@@ -24,6 +24,7 @@
 								name="ps_$!programStageInstance.id"
 								pi="$programInstance.id"
 								psid="$programStageInstance.programStage.id"
+								psuid="$programStageInstance.programStage.uid"
 								psname="$programStageInstance.programStage.displayName"
 								status="$programStageInstance.getEventStatus()"
 								programType='$programInstance.program.type'

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm	2013-04-03 15:46:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm	2013-04-04 05:07:53 +0000
@@ -50,45 +50,45 @@
 							</td>        
 							##entry        
 							<td class='input-column'>   
-								#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+								#set( $id = $programStageDataElement.programStage.uid + '-' + $programStageDataElement.dataElement.uid + '-val' )
 								#if( $!programStageDataElement.dataElement.optionSet )
 									#set( $hasOptionSet = 'true')
 								#else
 									#set( $hasOptionSet = 'false')
 								#end
 								#if( $programStageDataElement.dataElement.textType == "longText" )
-									<textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
+									<textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" onchange="saveVal( '$programStageDataElement.dataElement.uid' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" maxlength=255 >$!encoder.htmlEncode( $patientDataValue.value )</textarea>
 								#elseif( $programStageDataElement.dataElement.type == "bool" )
-									<select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
+									<select name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( '$programStageDataElement.dataElement.uid' )" tabindex="$tabIndex">
 										<option value="">[$i18n.getString( "select_value" )]</option>
 										<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
 										<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
 									</select>
 								#elseif( $programStageDataElement.dataElement.type == "trueOnly" )
-									<input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+									<input name="entryfield" type="checkbox" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" #if($patientDataValue.value=="true") checked #end onchange="saveVal( '$programStageDataElement.dataElement.uid' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
 								#elseif( $programStageDataElement.dataElement.type == "date" )
-									<input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="date-field datefield" >
+									<input name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory, deType:'$programStageDataElement.dataElement.getType()'}" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( '$programStageDataElement.dataElement.uid' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="date-field datefield" >
 									<script type="text/javascript">
-										datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false, false);
+										datePicker( '$programStageDataElement.programStage.uid'+ '-' + '$programStageDataElement.dataElement.uid' + '-val', false, false);
 									</script> 
 								#elseif($hasOptionSet=='true')
-									<input name="entryfield" options='$hasOptionSet' class="auto-field optionset" #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' uid='$programStageDataElement.dataElement.uid' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
+									<input name="entryfield" options='$hasOptionSet' class="auto-field optionset" #if($hasOptionSet == 'true') #end data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
 								#elseif($programStageDataElement.dataElement.type=='username')
-									<input name="entryfield" username='true' class="auto-field optionset" dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
+									<input name="entryfield" username='true' class="auto-field optionset" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
 								#else
-									<input name="entryfield" dataElementId='$programStageDataElement.dataElement.id' 
+									<input name="entryfield" 
 										data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" onkeypress="return keyPress(event, this)" tabindex="$tabIndex"
 										id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" 
-										onchange="saveVal( $programStageDataElement.dataElement.id )" 
+										onchange="saveVal( '$programStageDataElement.dataElement.uid' )" 
 										onkeypress="return keyPress(event, this)" tabindex="$tabIndex"/>
 								#end
 							</td> 
 							#if( $programStage.program.displayProvidedOtherFacility=='true' )
 							<td style='width:20px;' align='center'>
-								#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-facility' )
+								#set( $id = $programStageDataElement.programStage.uid + '-' + $programStageDataElement.dataElement.uid + '-facility' )
 								#if( $programStageDataElement.allowProvidedElsewhere == 'true')
 									<div id='span_$id' class='provided-elsewhere'>
-										<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
+										<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( '$programStageDataElement.dataElement.uid', this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
 									</div>
 								#end
 							</td>