← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2112: Enabled old code for displaying current selection in dataentry. Could need some cleanup here too ...

 

------------------------------------------------------------
revno: 2112
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2010-11-19 17:12:02 +0100
message:
  Enabled old code for displaying current selection in dataentry. Could need some cleanup here too but will leave it for later.
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/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-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-18 13:53:54 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-19 16:12:02 +0000
@@ -1,5 +1,5 @@
 
-window.onload = function () 
+function addEventListeners() 
 {
 	var inputs = document.getElementsByName( "entryfield" ) 
 
@@ -147,6 +147,10 @@
 
 function periodSelected()
 {
+	var periodName = $( '#selectedPeriodIndex :selected' ).text();
+	
+	$( '#currentPeriod' ).html( periodName );
+	
 	displayEntryFormInternal( true );
 }
 
@@ -161,15 +165,21 @@
 		var url = 'select.action?selectedPeriodIndex=' + periodIndex +
 			'&displayMode=' + $("input[name='displayMode']:checked").val();
 		
-		var callback = updateDisplayModes ? setDisplayModes : hideLoader;
+		var callback = updateDisplayModes ? setDisplayModes : displayEntryFormCompleted;
 		
 		$( '#contentDiv' ).load( url, callback );
 	}
 }
 
+function displayEntryFormCompleted()
+{
+	addEventListeners();
+	hideLoader();
+}
+
 function setDisplayModes()
 {
-	hideLoader();
+	displayEntryFormCompleted();
 	
 	$.getJSON( 'loadDisplayModes.action', function( json ) {
 		if ( json.customForm ) {