← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2790: Disabling next/previous period buttons in data entry while waiting for the period result. This ta...

 

------------------------------------------------------------
revno: 2790
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-02-01 09:53:47 +0100
message:
  Disabling next/previous period buttons in data entry while waiting for the period result. This takes a few seconds on slow lines and causes users to click multiple times and then entering data in the wrong year.
modified:
  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/select.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-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	2011-01-25 16:02:32 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2011-02-01 08:53:47 +0000
@@ -85,6 +85,8 @@
 
 function displayPeriodsInternal( next, previous ) 
 {
+	disableNextPrevButtons();
+	
 	var url = 'loadNextPreviousPeriods.action?next=' + next + '&previous=' + previous;
 	
 	var list = document.getElementById( 'selectedPeriodIndex' );
@@ -97,9 +99,23 @@
     	for ( i in json.periods ) {
     		addOptionToList( list, i, json.periods[i].name );
     	}
+    	
+    	enableNextPrevButtons();
     } );
 }
 
+function disableNextPrevButtons()
+{
+	$( '#nextButton' ).attr( 'disabled', 'disabled' );
+	$( '#prevButton' ).attr( 'disabled', 'disabled' );
+}
+
+function enableNextPrevButtons()
+{
+	$( '#nextButton' ).removeAttr( 'disabled' );
+	$( '#prevButton' ).removeAttr( 'disabled' );
+}
+
 // -----------------------------------------------------------------------------
 // DataSet Selection
 // -----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2011-01-25 14:49:09 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2011-02-01 08:53:47 +0000
@@ -31,8 +31,8 @@
 	<tr>
 		<td><label for="selectedPeriodIndex">$i18n.getString( "period" )</label></td>
 		<td>
-			<input type="button" style="width:50px" value="$i18n.getString( 'prev' )" title="$i18n.getString('earlier_periods')" onclick="previousPeriodsSelected()"><input 
-			       type="button" style="width:50px" value="$i18n.getString( 'next' )" title="$i18n.getString('later_periods')" onclick="nextPeriodsSelected()"><br/>
+			<input type="button" id="nextButton" style="width:50px" value="$i18n.getString( 'prev' )" title="$i18n.getString('earlier_periods')" onclick="previousPeriodsSelected()"><input 
+			       type="button" id="prevButton" style="width:50px" value="$i18n.getString( 'next' )" title="$i18n.getString('later_periods')" onclick="nextPeriodsSelected()"><br/>
 			<select id="selectedPeriodIndex" name="selectedPeriodIndex" style="min-width:350px" onchange="periodSelected()"></select>
 		</td>
 	</tr>