← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3733: Fix bug: The validation rules for the identifiers (types) into Add new patient are not working.

 

------------------------------------------------------------
revno: 3733
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-05-25 10:18:02 +0700
message:
  Fix bug: The validation rules for the identifiers (types) into Add new patient are not working.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.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/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-05-25 02:34:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-05-25 03:18:02 +0000
@@ -18,7 +18,7 @@
 				,errorElement:"span"
 				,submitHandler: function(form)
 					{
-						//validateAddPatient();
+						validateAddPatient();
 					}
 				,beforeValidateHandler: function(form)
 					{
@@ -43,7 +43,7 @@
 <h3>$i18n.getString( "add_new_patient" )</h3>	
 <p><input type="button" value="$i18n.getString( 'back_to_search' )" onclick="onClickBackBtn();" style="width:10em"/></p>
 
-<form id="addPatientForm" name="addPatientForm" method="post" onsubmit='validateAddPatient();'>
+<form id="addPatientForm" name="addPatientForm" method="post" >
 <input type="hidden" id="representativeId" name="representativeId"/> 
 <input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
 <table>
@@ -151,16 +151,13 @@
 	<tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
 	#foreach ($identifierType in $identifierTypes)
 	<tr>
-		<td><label>$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+		<td><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
 
         #if($identifierType.format == "State Format")
             <td><input type="hidden" id="iden$identifierType.id" name="iden$identifierType.id"/>
-            #if($organisationUnit.code == "null")
-                #set($organisationUnit.code = "" );
-            #end
 				<table>
 					<tr valign="top">
-						<td><input type="text" id="orgunitcode" name="orgunitcode" disabled="disabled" value="$organisationUnit.code" maxlength="9" size="10"/> <br/> <div class='stateformat'>$i18n.getString('registering_unit')<br>$i18n.getString('code')</div></td>
+						<td><input type="text" id="orgunitcode" name="orgunitcode" disabled="disabled" value="$!organisationUnit.code" maxlength="9" size="10"/> <br/> <div class='stateformat'>$i18n.getString('registering_unit')<br>$i18n.getString('code')</div></td>
 						<td> - <input type="text" id="progcode" name="progcode" maxlength="1" size="6" class='idfield  {validate:{required:$identifierType.mandatory,minlength:1,lettersdigitsonly:true}}' /> <br/> <div class='stateformat'>$i18n.getString('program')<br>$i18n.getString('code')</div></td>
 						<td> - <input type="text" id="yearcode" name="yearcode" maxlength="2" size="6" value="$year" class="{validate:{required:true,minlength:2}}"/> <br/> <div class='stateformat'>$i18n.getString('year')</div></td>
 						<td> - <input type="text" id="benicode" name="benicode" maxlength="4" size="9" class="{validate:{required:true,number:true,minlength:4}}"/> <br/> <div class='stateformat'>$i18n.getString('patient')<br>$i18n.getString('code')</div></td>
@@ -169,7 +166,7 @@
             </td>
         #else
             <td class="input-column">
-			<input type="text" style="width:28em" id="iden$identifierType.id" name="iden$identifierType.id" class='idfield' data="{related:$identifierType.related}" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
+			<input type="text" style="width:28em" id="iden$identifierType.id" name="iden$identifierType.id" data="{related:$identifierType.related}" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
         #end
 
 	</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-05-19 08:17:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-05-25 03:18:02 +0000
@@ -706,21 +706,14 @@
 	hideById('selectDiv');
 	hideById('searchPatientDiv');
 				
-	if( byId('addPatientDiv').innerHTML == '' )
-	{	
-		jQuery('#loaderDiv').show();
+	jQuery('#loaderDiv').show();
+	jQuery('#addPatientDiv').load('showAddPatientForm.action'
+		, function()
+		{
+			showById('addPatientDiv');
+			jQuery('#loaderDiv').hide();
+		});
 	
-		jQuery('#addPatientDiv').load('showAddPatientForm.action'
-			, function()
-			{
-				showById('addPatientDiv');
-				jQuery('#loaderDiv').hide();
-			});
-	}
-	else
-	{
-		showById('addPatientDiv');
-	}
 }
 
 function addPatient()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2011-05-13 09:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2011-05-25 03:18:02 +0000
@@ -49,7 +49,7 @@
 <h3>$i18n.getString( "update_patient" )</h3>
 <p><input type="button" value="$i18n.getString( 'back_to_search' )" onclick="onClickBackBtn();" style="width:10em"/></p>
 
-<form id="updatePatientForm" name="updatePatientForm" action="" method="post" onsubmit='updatePatient();'>
+<form id="updatePatientForm" name="updatePatientForm" action="" method="post" >
 <input type="hidden" id="representativeId" name="representativeId"/> 
 <input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
 <div>
@@ -82,7 +82,7 @@
 	<tr>
 		<td><label for="dobType">$i18n.getString( "dob_type" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
 		<td class="input-column" >
-			<select id='dobType' name="dobType" style="width:30.3em" onchange="dobTypeOnChange();" class="{validate:{required:false}}">
+			<select id='dobType' name="dobType" style="width:30.3em" onchange="dobTypeOnChange();" class="{validate:{required:true}}">
 				<option value="" selected="selected">[$i18n.getString( "please_select" )]</option>
 				<option value="V" #if($patient.dobType=='V') selected #end>$i18n.getString( "verified" )</option>
 				<option value="D" #if($patient.dobType=='D') selected #end>$i18n.getString( "declared" )</option>
@@ -178,11 +178,10 @@
 	#set( $identifier = $identiferMap.get( $identifierType.id ) )
 	<tr>
 		<td><label for="bloodGroup">$identifierType.name #if($identifierType.mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
-		<td class="input-column" ><input type="text" id="iden$identifierType.id" style="width:30em" name="iden$identifierType.id" class='idfield' value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" style="width:30em" /></td>	
+		<td class="input-column" ><input type="text" id="iden$identifierType.id" style="width:30em" name="iden$identifierType.id" value="$identifier" data="{related:$identifierType.related}" #if($identifierType.related && $patient.underAge) disabled="disabled" #end class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" style="width:30em" /></td>	
 	</tr>
 	#end
 	<tr><td>&nbsp;</td></tr>
-	<tr><td>&nbsp;</td></tr>
 	
 	<!-- ATTRIBUTES IN GROUPS -->