← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5897: (patient) Lock screen after clicking Add/Update button in Add/Update patient form.

 

------------------------------------------------------------
revno: 5897
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-02-09 10:25:25 +0700
message:
  (patient) Lock screen after clicking Add/Update button in Add/Update patient form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.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-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-02-01 09:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2012-02-09 03:25:25 +0000
@@ -142,6 +142,7 @@
 
 function validateAddPatient()
 {	
+	$("#editPatientDiv :input").attr("disabled", true);
 	$.ajax({
 		type: "POST",
 		url: 'validatePatient.action',
@@ -160,17 +161,21 @@
 		removeDisabledIdentifier( );
 		addPatient( );
 	}
-	else if ( type == 'error' )
-	{
-		showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
-	}
-	else if ( type == 'input' )
-	{
-		showWarningMessage( message );
-	}
-	else if( type == 'duplicate' )
-	{
-		showListPatientDuplicate(data, false);
+	else
+	{
+		$("#editPatientDiv :input").attr("disabled", true);
+		if ( type == 'error' )
+		{
+			showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message );
+		}
+		else if ( type == 'input' )
+		{
+			showWarningMessage( message );
+		}
+		else if( type == 'duplicate' )
+		{
+			showListPatientDuplicate(data, false);
+		}
 	}
 }
 
@@ -181,7 +186,8 @@
 
 function validateUpdatePatient()
 {
-    $.post( 'validatePatient.action?' + getIdParams( ), 
+	$("#editPatientDiv :input").attr("disabled", true);
+	$.post( 'validatePatient.action?' + getIdParams( ), 
 		{ 
 			id: jQuery( '#patientForm [id=id]' ).val(),
 			fullName: jQuery( '#patientForm [id=fullName]' ).val(),
@@ -200,18 +206,22 @@
     	removeDisabledIdentifier();
     	updatePatient();
     }
-    else if ( type == 'error' )
-    {
-        showErrorMessage( i18n_saving_patient_failed + ':' + '\n' + message );
-    }
-    else if ( type == 'input' )
-    {
-        showWarningMessage( message );
-    }
-    else if( type == 'duplicate' )
-    {
-    	showListPatientDuplicate(messageElement, true);
-    }
+	else
+	{
+		$("#editPatientDiv :input").attr("disabled", true);
+		if ( type == 'error' )
+		{
+			showErrorMessage( i18n_saving_patient_failed + ':' + '\n' + message );
+		}
+		else if ( type == 'input' )
+		{
+			showWarningMessage( message );
+		}
+		else if( type == 'duplicate' )
+		{
+			showListPatientDuplicate(messageElement, true);
+		}
+	}
 }
 // get and build a param String of all the identifierType id and its value
 // excluding inherited identifiers