← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2608: Cannot add/update PatientAttribute without inputting noChars property.

 

------------------------------------------------------------
revno: 2608
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-18 16:28:29 +0700
message:
  Cannot add/update PatientAttribute without inputting noChars property.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.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/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2010-12-10 05:57:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2011-01-18 09:28:29 +0000
@@ -6,12 +6,14 @@
 			
 			validation( 'addPatientAttributeForm', function(form){
 				if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
-					form.submit();
+					form.submit(i18n_field_is_required);
 				}
 			}, function(){
 				isSubmit = true;
-				jQuery.each($('#addPatientAttributeForm').serializeArray(), function(i, field) {
-					if( field.value == ""){
+				
+				var fields = $("#addPatientAttributeForm").serializeArray();
+				jQuery.each(fields, function(i, field) {
+					if(  field.name.match("^attrOption")=='attrOption' && field.value == ""){
 						setInnerHTML("attrMessage", i18n_field_is_required);
 						isSubmit = false;
 					}
@@ -90,19 +92,19 @@
         </td>
         <td></td>
     </tr>  
-    <tr>
+	<tr id="attributeComboRow"> 
+		<td width="20em"><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+		<td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em"  onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
+		</td>
+		<td><span id="attrMessage"  name="attrMessage" style="color:red;"></span></td>
+	</tr>
+	<tr>
     	<td width="20em"><label for="groupBy">$i18n.getString( "groupBy" )</td>
     	<td><input type="checkbox" name="groupBy" value="true"></td>
     </tr>
-    <tr id="attributeComboRow"> 
-    	<td width="20em"><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-    	<td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em"  onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
-		</td>
-    	<td><span id="attrMessage"  name="attrMessage" style="color:red;"></span></td>
-    </tr>
      </tbody>
 </table>
-
+<span id='message'></span>
 <p>
     <input type="submit" value="$i18n.getString( "add" )" style="width:10em">
     <input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='patientAttribute.action'" style="width:10em">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2010-12-10 05:57:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2011-01-18 09:28:29 +0000
@@ -11,16 +11,16 @@
 				}
 			}, function(){
 				isSubmit = true;
-				jQuery.each($('#updatePatientAttributeForm').serializeArray(), function(i, field) {
-					if( field.value == ""){
+				
+				var fields = $("#addPatientAttributeForm").serializeArray();
+				jQuery.each(fields, function(i, field) {
+					if(  field.name.match("^attrOption")=='attrOption' && field.value == ""){
 						setInnerHTML("attrMessage", i18n_field_is_required);
 						isSubmit = false;
 					}
 				});
 			}); 
 			
-			jQuery("#attributeComboRow").hide();
-			
 			checkValueIsExist( "name", "validatePatientAttribute.action", {id:getFieldValue('id')});
 
 	});		
@@ -91,11 +91,8 @@
             </select>
         </td>
     </tr>
-      <tr>
-    	<td width="20em"><label for="groupBy">$i18n.getString( "groupBy" )</td>
-    	<td><input type="checkbox" name="groupBy" value="true" #if( $patientAttribute.groupBy == 'true' ) checked #end></td>
-      </tr>
-      <tr id="attributeComboRow"> 
+      
+	  <tr id="attributeComboRow"> 
     	<td width="20em"><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
     	<td >
     		<table id="attrOptionContainer">
@@ -111,6 +108,10 @@
       <tr>
         <td colspan="3" style="height:15px"></td>
       </tr>
+	  <tr>
+    	<td width="20em"><label for="groupBy">$i18n.getString( "groupBy" )</td>
+    	<td><input type="checkbox" name="groupBy" value="true" #if( $patientAttribute.groupBy == 'true' ) checked #end></td>
+      </tr>
     </tbody>
   </table>  
 
@@ -121,3 +122,12 @@
 
 </form>     
 <span id="message"></span>
+<script>
+	if( jQuery('#valueType').val() == "COMBO")
+	{
+		jQuery("#attributeComboRow").show();
+	}else
+	{
+		jQuery("#attributeComboRow").hide();
+	}
+</script>