← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7057: local vn - Fixed logic bug while choosing an attribute value to show entry form.

 

------------------------------------------------------------
revno: 7057
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-05-28 10:47:36 +0700
message:
  local vn - Fixed logic bug while choosing an attribute value to show entry form.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.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-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2012-03-26 06:36:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2012-05-28 03:47:36 +0000
@@ -40,7 +40,7 @@
 		});
 }
 
-function autoCompletedField( )
+function autoCompletedField()
 {
 	var select = jQuery( "#aggregationDataElementId" );
 	$( "#dataElementsButton" ).unbind('click');

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-05-23 09:36:45 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-05-28 03:47:36 +0000
@@ -234,7 +234,6 @@
 			setHeaderDelayMessage( i18n_disconnect_server );
 			return;
         }
-
 		loadDataValues( dataSetId );
 	} );
 }
@@ -403,7 +402,7 @@
 				
 				jQuery("#valueInput").unbind('change');
 				jQuery("#value").unbind('select');
-				jQuery('#selectedPeriodId').unbind('change');
+				jQuery('#selectedPeriodId').bind('change', periodSelected);
 			}
 			else 
 			{
@@ -429,21 +428,24 @@
 				clearListById( 'value' );
 				for ( i in json.attributeValues ) 
 				{ 
-					$('#value').append('<option value=' + json.attributeValues[i] + '>' + json.attributeValues[i] + '</option>');
+					$('#value').append('<option value="' + json.attributeValues[i] + '">' + json.attributeValues[i] + '</option>');
 				}
+
 				autoCompletedField();
+				
 				jQuery("#valueInput").bind('change', periodSelected);
 				jQuery("#value").bind('select', periodSelected);
-				jQuery('#selectedPeriodId').unbind('change');
+				
 				showById('attributeDiv');
 			}
 			else
 			{
 				jQuery("#valueInput").unbind('change');
 				jQuery("#value").unbind('change');
-				jQuery('#selectedPeriodId').bind('change', periodSelected);
 				hideById('attributeDiv');
 			}
+			
+			jQuery('#selectedPeriodId').bind('change', periodSelected);
 		} );
 }
 
@@ -473,7 +475,7 @@
 
 function periodSelected()
 {
-    var periodName = $( '#selectedPeriodId  option:selected' ).text();
+    var periodName = $( '#selectedPeriodId option:selected' ).text();
     var dataSetId = $( '#selectedDataSetId option:selected' ).val();
 
     $( '#currentPeriod' ).html( periodName );
@@ -483,7 +485,7 @@
     if ( periodId && periodId != -1 )
     {
         showLoader();
-        loadForm( dataSetId, byId( 'valueInput' ).value );
+        loadForm( dataSetId, getFieldValue( 'valueInput' ) );
     }
 	else
 	{
@@ -532,7 +534,7 @@
 	        periodId : periodId,
 	        dataSetId : dataSetId,
 			attributeId: getFieldValue( 'attributeId' ),
-			value: byId( 'valueInput' ).value,
+			value: getFieldValue( 'valueInput' ),
 	        organisationUnitId : currentOrganisationUnitId
 	    },
 	    dataType: 'json',
@@ -1558,7 +1560,7 @@
 	var select = jQuery( "#value" );
 	$( "#valueButton" ).unbind('click');
 	enable( 'valueButton' );
-	var selected = select.children( ":selected" );
+	var selected = select.children( "option:selected" );
 	var value = selected.val() ? selected.text() : "";
 	
 	var input = jQuery( "#valueInput" )
@@ -1572,25 +1574,25 @@
 				response( select.children( "option" ).map(function() {
 					var text = $( this ).text();
 					if ( this.value && ( !request.term || matcher.test(text) ) )
+					{
 						return {
 							label: text,
 							value: text,
 							option: this
 						};
+					}
 				}) );
 			},
 			select: function( event, ui ) {
 				ui.item.option.selected = true;
-				periodSelected();
 			},
 			change: function( event, ui ) {
 				if ( !ui.item ) {
 					var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
-						valid = false;
+					valid = false;
 					select.children( "option" ).each(function() {
 						if ( $( this ).text().match( matcher ) ) {
 							this.selected = valid = true;
-							periodSelected();
 							return false;
 						}
 					});
@@ -1599,8 +1601,7 @@
 					}
 				}
 			}
-		})
-		.addClass( "ui-widget ui-widget-content ui-corner-left" );
+		}).addClass( "ui-widget ui-widget-content ui-corner-left" );
 
 	input.data( "autocomplete" )._renderItem = function( ul, item ) {
 		return $( "<li></li>" )