← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1560: Fix bug in Update Patient Attribute Value page.

 

------------------------------------------------------------
revno: 1560
committer: Viet <Viet@Viet-Laptop>
branch nick: trunk
timestamp: Fri 2010-03-05 18:30:37 +0530
message:
  Fix bug in Update Patient Attribute Value page.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeValueAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeValue.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttributeValueForm.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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeValueAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeValueAction.java	2010-02-17 13:38:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/SavePatientAttributeValueAction.java	2010-03-05 13:00:37 +0000
@@ -26,10 +26,13 @@
  */
 package org.hisp.dhis.patient.action.patientattribute;
 
+import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeOption;
+import org.hisp.dhis.patient.PatientAttributeOptionService;
 import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
@@ -71,7 +74,13 @@
     {
         this.patientAttributeValueService = patientAttributeValueService;
     }
+    
+    private PatientAttributeOptionService patientAttributeOptionService;
 
+    public void setPatientAttributeOptionService( PatientAttributeOptionService patientAttributeOptionService )
+    {
+        this.patientAttributeOptionService = patientAttributeOptionService;
+    }
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -136,9 +145,20 @@
             {
 
                 LOG.debug( "Adding PatientAttributeValue, value added" );
-
-                patientAttributeValue = new PatientAttributeValue( patientAttribute, patient, value );
-
+                
+                if( patientAttribute.getValueType().equalsIgnoreCase( PatientAttribute.TYPE_COMBO ) )
+                {
+                    PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value,0 ) );
+                    if( option != null )
+                    {
+                        patientAttributeValue = new PatientAttributeValue( patientAttribute, patient );
+                        patientAttributeValue.setPatientAttributeOption( option );
+                        patientAttributeValue.setValue( option.getName() );
+                    }
+                }else
+                {
+                    patientAttributeValue = new PatientAttributeValue( patientAttribute, patient, value );
+                }
                 patientAttributeValueService.savePatientAttributeValue( patientAttributeValue );
             }
         }
@@ -146,11 +166,23 @@
         {
             LOG.debug( "Updating PatientAttributeValue, value added/changed" );
 
-            patientAttributeValue.setValue( value );
+            if( patientAttribute.getValueType().equalsIgnoreCase( PatientAttribute.TYPE_COMBO ) )
+            {
+                PatientAttributeOption option = patientAttributeOptionService.get( NumberUtils.toInt( value, 0 ) );
+                if( option != null )
+                {
+                    patientAttributeValue.setPatientAttributeOption( option );
+                    patientAttributeValue.setValue( option.getName() );
+                }
+            }else
+            {
+                patientAttributeValue.setValue( value );
+            }
 
             patientAttributeValueService.updatePatientAttributeValue( patientAttributeValue );
         }
 
         return SUCCESS;
     }
+
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java	2010-01-29 03:08:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/ShowUpdatePatientAttributeValueAction.java	2010-03-05 13:00:37 +0000
@@ -36,6 +36,7 @@
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeGroup;
 import org.hisp.dhis.patient.PatientAttributeGroupService;
+import org.hisp.dhis.patient.PatientAttributeService;
 import org.hisp.dhis.patient.PatientService;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
 import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
@@ -60,13 +61,13 @@
         this.patientService = patientService;
     }
 
-    // private PatientAttributeService patientAttributeService;
-    //
-    // public void setPatientAttributeService( PatientAttributeService
-    // patientAttributeService )
-    // {
-    // this.patientAttributeService = patientAttributeService;
-    // }
+     private PatientAttributeService patientAttributeService;
+    
+     public void setPatientAttributeService( PatientAttributeService
+     patientAttributeService )
+     {
+     this.patientAttributeService = patientAttributeService;
+     }
 
     private PatientAttributeGroupService patientAttributeGroupService;
 
@@ -100,11 +101,11 @@
         return patient;
     }
 
-    Collection<PatientAttribute> patientAttributes;
+    Collection<PatientAttribute> patientNoGroupAttributes;
 
-    public Collection<PatientAttribute> getPatientAttributes()
+    public Collection<PatientAttribute> getPatientNoGroupAttributes()
     {
-        return patientAttributes;
+        return patientNoGroupAttributes;
     }
 
     private Map<Integer, PatientAttributeValue> patientAttributeValueMap;
@@ -147,19 +148,21 @@
     {
         patient = patientService.getPatient( id );
 
-        if ( patientAttributeGroups == null )
+//        if ( patientAttributeGroups == null )
             patientAttributeGroups = patientAttributeGroupService.getAllPatientAttributeGroups();
 
-        if ( patientAttributeGroupId != 0 )
-        {
-            patientAttributes = new ArrayList<PatientAttribute>();
-
-            patientAttributes = patientAttributeGroupService.getPatientAttributeGroup(
-                patientAttributeGroupId ).getAttributes();
-        }
-
-        // patientAttributes =
-        // patientAttributeService.getAllPatientAttributes();
+//        if ( patientAttributeGroupId != 0 )
+//        {
+//            patientAttributes = new ArrayList<PatientAttribute>();
+//
+//            patientAttributes = patientAttributeGroupService.getPatientAttributeGroup(
+//                patientAttributeGroupId ).getAttributes();
+//        }else 
+//        {
+//             patientAttributes = patientAttributeService.getAllPatientAttributes();
+//        }
+            
+        patientNoGroupAttributes = patientAttributeService.getPatientAttributesNotGroup();
 
         Collection<PatientAttributeValue> patientAttributeValues = patientAttributeValueService
             .getPatientAttributeValues( patient );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-03-03 11:02:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-03-05 13:00:37 +0000
@@ -237,11 +237,10 @@
 		id="org.hisp.dhis.patient.action.patientattribute.ShowUpdatePatientAttributeValueAction"
 		class="org.hisp.dhis.patient.action.patientattribute.ShowUpdatePatientAttributeValueAction"
 		scope="prototype">
-		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-		<!--
-			<property name="patientAttributeService"
+		<property name="patientService"
+			 ref="org.hisp.dhis.patient.PatientService" />
+		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
-		-->
 		<property name="patientAttributeGroupService"
 			ref="org.hisp.dhis.patient.PatientAttributeGroupService" />
 		<property name="patientAttributeValueService"
@@ -257,6 +256,8 @@
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
 		<property name="patientAttributeValueService"
 			ref="org.hisp.dhis.patientattributevalue.PatientAttributeValueService" />
+		<property name="patientAttributeOptionService"
+			ref="org.hisp.dhis.patient.PatientAttributeOptionService" />
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-03-03 11:02:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-03-05 13:00:37 +0000
@@ -131,15 +131,15 @@
 		                    <option value="false" selected="selected">$i18n.getString( "no" )</option>
 		                </select>                
 		            #elseif( $attribute.valueType == "DATE" )
-		                <input type="text" id="attr$attribute.id"  name="attr$attribute.id" style="width:30em" class=' #validate( "default"  $attribute.mandatory )'>
-		                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$attribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
-		                    <script type="text/javascript">
-		                        Calendar.setup({
-		                            inputField     :    "attr$attribute.id",      // id of the input field
-		                            ifFormat       :    "$i18n.getString('format.date.label')",       // format of the input field
-		                            button         :    "getDateValue$attribute.id"   // trigger for the calendar (button ID)
-		                        });
-		                    </script>                    
+	                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$attribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
+	                	<input type="text" id="attr$attribute.id"  name="attr$attribute.id" style="width:30em" class=' #validate( "default"  $attribute.mandatory )'>
+	                    <script type="text/javascript">
+	                        Calendar.setup({
+	                            inputField     :    "attr$attribute.id",      // id of the input field
+	                            ifFormat       :    "$i18n.getString('format.date.label')",       // format of the input field
+	                            button         :    "getDateValue$attribute.id"   // trigger for the calendar (button ID)
+	                        });
+	                    </script>                    
 					#elseif( $attribute.valueType == "COMBO" )
 						<select  id="attr$attribute.id"  name="attr$attribute.id" style="width:30em" class=' #validate( "default"  $attribute.mandatory )' >
 							 <option value="">[$i18n.getString( "please_select" )]</option>
@@ -171,8 +171,8 @@
 		                    <option value="false" >$i18n.getString( "no" )</option>
 		                </select>                
 		            #elseif( $attribute.valueType == "DATE" )
-		                <input type="text" id="$attribute.id"  style="width:30em" name="attr$attribute.id"  class=' #validate( "default"  $attribute.mandatory )' >
 		                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$attribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
+		                	<input type="text" id="$attribute.id"  style="width:30em" name="attr$attribute.id"  class=' #validate( "default"  $attribute.mandatory )' >
 		                    <script type="text/javascript">
 		                        Calendar.setup({
 		                            inputField     :    "attr$attribute.id",      // id of the input field

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeValue.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeValue.js	2010-01-29 09:15:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttributeValue.js	2010-03-05 13:00:37 +0000
@@ -48,7 +48,12 @@
 	var valueSaver = new ValueSaver( patientId, patientAttributeId, selectedOption.options[selectedOption.selectedIndex].value, '#ccffcc', selectedOption );
 	valueSaver.save();
 }
-
+function saveCombo( patientId, patientAttributeId, selectedOption )
+{
+	selectedOption.style.backgroundColor = '#ffffcc';
+	var valueSaver = new ValueSaver( patientId, patientAttributeId, selectedOption.options[selectedOption.selectedIndex].value, '#ccffcc', selectedOption );
+	valueSaver.save();
+}
 
 // ------------------------------------------------------------------------------
 // Saver objects
@@ -155,14 +160,19 @@
      
 		var element;
      
-		if ( type == 'bool' )
+		if ( type == 'YES/NO' )
 		{
 			element = document.getElementById( 'value[' + patientAttributeId + '].boolean' );
-		}		
+		}	
+		else if ( type == "COMBO")
+		{           
+			element = document.getElementById( 'value[' + patientAttributeId + '].combo' );                      
+		}
 		else
 		{           
 			element = document.getElementById( 'value[' + patientAttributeId + '].value' );                      
 		}
+		
              
 		element.style.backgroundColor = color;
 	}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttributeValueForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttributeValueForm.vm	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttributeValueForm.vm	2010-03-05 13:00:37 +0000
@@ -49,7 +49,7 @@
     <col width="20%">
     <col width="30">
     <tr>
-        <th>$i18n.getString( "nr" )</th>
+        <th style="text-align: center">$i18n.getString( "nr" )</th>
         <th>$i18n.getString( "attribute" )</th>  
         <th>$i18n.getString( "value_type" )</th>              
         <th>$i18n.getString( "entry" )</th>        
@@ -58,7 +58,9 @@
 #set( $rowCount = 0 )
 #set( $mark = 0 )
 #set( $tabIndex = 1 )
-
+#foreach( $attributeGroup in $patientAttributeGroups )
+<tr style="background-color: #BFD0FF; "><td colspan="4">$attributeGroup.name</td></tr>
+#set( $patientAttributes = $attributeGroup.getAttributes() )
 #foreach( $patientAttribute in $patientAttributes )
     #set( $rowCount = $rowCount + 1 )    
     #if( $mark == 1 )
@@ -70,36 +72,100 @@
     #set( $patientAttributeValue = $patientAttributeValueMap.get( $patientAttribute.id ) )    
     <tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
         ##rowCount
-        <td style="text-align:right">$rowCount</td>
-                
-        ##attribute name
-        <td>
-            <span id="value[$patientAttribute.id].name" title="$!encoder.htmlEncode( $patientAttribute.description )">
-                $encoder.htmlEncode( $patientAttribute.name )            
-            </span>
-        </td>        
-        ##type        
-        <td>            
-            <span id="value[$patientAttribute.id].valueType">$encoder.htmlEncode( $patientAttribute.valueType )</span>
-        </td>       
-        ##entry        
-        <td>        
-            #if( $patientAttribute.valueType == "bool" )
-                <select name="entryselect" id="value[$patientAttribute.id].boolean" onchange="saveBoolean( $patient.id, $patientAttribute.id, this )" style="width:100%" tabindex="$tabIndex">              
-                    <option value="">[$i18n.getString( "please_select" )]</option>
-                    <option value="true" #if( $patientAttributeValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
-                    <option value="false" #if( $patientAttributeValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
-                </select>                
-            #elseif( $patientAttribute.valueType == "date" )
-                <input type="text" id="value[$patientAttribute.id].date" name="entryfield" value="$!encoder.htmlEncode( $patientAttributeValue.value )" onchange="saveDate( $patient.id, $patientAttribute.id, '$encoder.jsEncode( $patientAttribute.name )' )" tabindex="$tabIndex" >
-                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
-                    <script type="text/javascript">
-                        Calendar.setup({
-                            inputField     :    "value[$patientAttribute.id].date",      // id of the input field
-                            ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
-                            button         :    "getDateValue"   // trigger for the calendar (button ID)
-                        });
-                    </script>                    
+        <td style="text-align: center">$rowCount</td>
+                
+        ##attribute name
+        <td>
+            <span id="value[$patientAttribute.id].name" title="$!encoder.htmlEncode( $patientAttribute.description )">
+                $encoder.htmlEncode( $patientAttribute.name )            
+            </span>
+        </td>        
+        ##type        
+        <td>            
+            <span id="value[$patientAttribute.id].valueType">$encoder.htmlEncode( $patientAttribute.valueType )</span>
+        </td>       
+        ##entry        
+        <td>        
+            #if( $patientAttribute.valueType == "YES/NO" )
+                <select name="entryselect" id="value[$patientAttribute.id].boolean" onchange="saveBoolean( $patient.id, $patientAttribute.id, this )" style="width:100%" tabindex="$tabIndex">              
+                    <option value="">[$i18n.getString( "please_select" )]</option>
+                    <option value="true" #if( $patientAttributeValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+                    <option value="false" #if( $patientAttributeValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+                </select>                
+            #elseif( $patientAttribute.valueType == "DATE" )
+                <input type="text" id="value[$patientAttribute.id].date" name="entryfield" value="$!encoder.htmlEncode( $patientAttributeValue.value )" onchange="saveDate( $patient.id, $patientAttribute.id, '$encoder.jsEncode( $patientAttribute.name )' )" tabindex="$tabIndex" >
+                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$patientAttribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
+                    <script type="text/javascript">
+                        Calendar.setup({
+                            inputField     :    "value[$patientAttribute.id].date",      // id of the input field
+                            ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
+                            button         :    "getDateValue$patientAttribute.id"   // trigger for the calendar (button ID)
+                        });
+                    </script>     
+            #elseif( $patientAttribute.valueType == "COMBO" )
+					<select name="entryselect" id="value[$patientAttribute.id].combo"  name="entryfield" onchange="saveCombo( $patient.id, $patientAttribute.id, this)" tabindex="$tabIndex"  >
+						 <option value="">[$i18n.getString( "please_select" )]</option>
+						#foreach ($option in $patientAttribute.attributeOptions )
+							<option value="$option.id" #if($patientAttributeValue.patientAttributeOption.id == $option.id ) selected="selected" #end>$option.name</option>
+						#end
+					</select>
+            #else
+                <input name="entryfield" id="value[$patientAttribute.id].value" type="text" value="$!encoder.htmlEncode( $patientAttributeValue.value )" onchange="saveAttributeValue( $patient.id, $patientAttribute.id, '$encoder.jsEncode( $dataElement.name )' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+            #end
+        </td>       
+    </tr>
+    #set( $tabIndex = $tabIndex + 1 )
+#end
+#end
+<tr style="background-color: #BFD0FF;"><td colspan="4">$i18n.getString("other_attributes")</td></tr>
+#foreach( $patientAttribute in $patientNoGroupAttributes )
+    #set( $rowCount = $rowCount + 1 )    
+    #if( $mark == 1 )
+        #set( $mark = 0 )
+    #else
+        #set( $mark = 1 )
+    #end    
+    #set( $patientAttributeValue = false )
+    #set( $patientAttributeValue = $patientAttributeValueMap.get( $patientAttribute.id ) )    
+    <tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
+        ##rowCount
+        <td style="text-align: center">$rowCount</td>
+                
+        ##attribute name
+        <td>
+            <span id="value[$patientAttribute.id].name" title="$!encoder.htmlEncode( $patientAttribute.description )">
+                $encoder.htmlEncode( $patientAttribute.name )            
+            </span>
+        </td>        
+        ##type        
+        <td>            
+            <span id="value[$patientAttribute.id].valueType">$encoder.htmlEncode( $patientAttribute.valueType )</span>
+        </td>       
+        ##entry        
+        <td>        
+            #if( $patientAttribute.valueType == "YES/NO" )
+                <select name="entryselect" id="value[$patientAttribute.id].boolean" onchange="saveBoolean( $patient.id, $patientAttribute.id, this )" style="width:100%" tabindex="$tabIndex">              
+                    <option value="">[$i18n.getString( "please_select" )]</option>
+                    <option value="true" #if( $patientAttributeValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+                    <option value="false" #if( $patientAttributeValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+                </select>                
+            #elseif( $patientAttribute.valueType == "DATE" )
+                <input type="text" id="value[$patientAttribute.id].date" name="entryfield" value="$!encoder.htmlEncode( $patientAttributeValue.value )" onchange="saveDate( $patient.id, $patientAttribute.id, '$encoder.jsEncode( $patientAttribute.name )' )" tabindex="$tabIndex" >
+                    <img src="../images/calendar_icon.gif" width="16" height="16" id="getDateValue$patientAttribute.id" style="cursor: pointer;" title="$i18n.getString("date_selector")" onmouseover="this.style.background='orange';" onmouseout="this.style.background=''" alt="$i18n.getString( "date" )">
+                    <script type="text/javascript">
+                        Calendar.setup({
+                            inputField     :    "value[$patientAttribute.id].date",      // id of the input field
+                            ifFormat       :    "$i18n.getString("format.date.label")",       // format of the input field
+                            button         :    "getDateValue$patientAttribute.id"   // trigger for the calendar (button ID)
+                        });
+                    </script>     
+            #elseif( $patientAttribute.valueType == "COMBO" )
+					<select name="entryselect" id="value[$patientAttribute.id].combo"  name="entryfield" onchange="saveCombo( $patient.id, $patientAttribute.id, this )" tabindex="$tabIndex"  >
+						 <option value="">[$i18n.getString( "please_select" )]</option>
+						#foreach ($option in $patientAttribute.attributeOptions )
+							<option value="$option.id" #if($patientAttributeValue.patientAttributeOption.id == $option.id ) selected="selected" #end>$option.name</option>
+						#end
+					</select>
             #else
                 <input name="entryfield" id="value[$patientAttribute.id].value" type="text" value="$!encoder.htmlEncode( $patientAttributeValue.value )" onchange="saveAttributeValue( $patient.id, $patientAttribute.id, '$encoder.jsEncode( $dataElement.name )' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
             #end