← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8757: Don't run validation in Add/Update attribute group form.

 

------------------------------------------------------------
revno: 8757
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-30 10:14:52 +0700
message:
  Don't run validation in Add/Update attribute group form.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeGroupForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeGroupForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteGroupForm.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/addPatientAttributeGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeGroupForm.vm	2012-10-15 04:35:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeGroupForm.vm	2012-10-30 03:14:52 +0000
@@ -2,7 +2,7 @@
 
 <h3>$i18n.getString( "create_new_patient_attribute_group" )</h3>
 																			
-<form id="addPatientAttributeGroupForm" action="addPatientAttributeGroup.action" method="post" >
+<form id="addPatientAttributeGroupForm" name="addPatientAttributeGroupForm" action="addPatientAttributeGroup.action" method="post" >
 
 <table>
 	<tr>
@@ -10,11 +10,11 @@
 	</tr>
 	<tr>
 		<td>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></td>
-		<td><input type="text" id="name" name="name"/></td>
+		<td><input type="text" id="name" name="name" class="{validate:{required:true}}"/></td>
 	</tr> 	
 	<tr>
 		<td>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></td>
-		<td><input type="text" id="description" name="description"/></td>
+		<td><input type="text" id="description" name="description" class="{validate:{required:true}}"/></td>
 	</tr>
 	<tr>
 		<td colspan="2">&nbsp;</td>
@@ -31,7 +31,7 @@
 		<th>$i18n.getString( "availableAttribute" )</th>
 		<th>$i18n.getString( "filter" )</th>
 		<th>$i18n.getString( "selectedAttribute" )
-			<select id="memberValidator" multiple="multiple" class="{validate:{required:true}} hidden"/>
+			<input type='hidden' id='hasAttributes' name='hasAttributes' class="{validate:{required:true}}">
 		</th>
 	</tr>
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeGroupForm.js	2012-05-23 19:48:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeGroupForm.js	2012-10-30 03:14:52 +0000
@@ -16,17 +16,14 @@
 		});
 		
 		
-		validation2( 'addPatientAttributeGroupForm', function(form){
+		validation( 'addPatientAttributeGroupForm', function(form){
 			form.submit();
-		}, {
-			'beforeValidateHandler' : function()
-			{
-				listValidator( 'memberValidator', 'selectedAttributes' );
-			},
-			'rules' : getValidationRules( 'patientAttributeGroup' )
-		} ); 
+		}, function(){
+			selectAllById('selectedAttributes');
+			if(jQuery("#selectedAttributes option").length > 0 ){
+				setFieldValue('hasAttributes', 'true');
+			}
+		});
 		
 		checkValueIsExist( "name", "validatePatientAttributeGroup.action" );
-		
-		
 	});		
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeGroupForm.js	2012-05-23 19:48:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeGroupForm.js	2012-10-30 03:14:52 +0000
@@ -2,15 +2,14 @@
 	
 	jQuery('name').focus();
 
-	validation2( 'updatePatientAttributeGroupForm', function(form){
-		form.submit();
-	}, {
-		'beforeValidateHandler' : function()
-		{
-			listValidator( 'memberValidator', 'selectedAttributes' );
-		},
-		'rules' : getValidationRules( 'patientAttributeGroup' )
-	});
+	validation( 'updatePatientAttributeGroupForm', function(form){
+			form.submit();
+		}, function(){
+			selectAllById('selectedAttributes');
+			if(jQuery("#selectedAttributes option").length > 0 ){
+				setFieldValue('hasAttributes', 'true');
+			}
+		});
 
 	checkValueIsExist( "name", "validatePatientAttributeGroup.action", {id:getFieldValue('id')});
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm	2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientAttributeGroup.vm	2012-10-30 03:14:52 +0000
@@ -14,7 +14,9 @@
 		  	<td></td>
 			<td colspan="3" style="text-align:right">
 				<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddPatientAttributeGroupForm.action'" style="width:75px">
+				#if($patientAttributeGroups.size() > 0)
 				<input type="button" value="$i18n.getString( 'sort' )" onclick="window.location.href='showSortPatientAttributeGroup.action'" style="width:75px"><br>
+				#end
 			</td>
 		  </tr>
           <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteGroupForm.vm	2012-10-15 04:35:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteGroupForm.vm	2012-10-30 03:14:52 +0000
@@ -13,11 +13,11 @@
 	</tr>
 	<tr>
 		<td>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></td>
-		<td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $patientAttributeGroup.name )" /></td>
+		<td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $patientAttributeGroup.name )" class="{validate:{required:true}}"/></td>
 	</tr>   
 	<tr>
 		<td>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></td>
-		<td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $patientAttributeGroup.description )" /></td>
+		<td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $patientAttributeGroup.description )" class="{validate:{required:true}}"/></td>
 	</tr>
 	<tr>
 		<td colspan="2" height="15px"></td>
@@ -34,7 +34,7 @@
 		<th>$i18n.getString( "availableAttribute" )</th>
 		<th>$i18n.getString( "filter" )</th>
 		<th>$i18n.getString( "selectedAttribute" )
-			<select id="memberValidator" multiple="multiple" class="{validate:{required:true}} hidden"/>
+			<input type='hidden' id='hasAttributes' name='hasAttributes' class="{validate:{required:true}}">
 		</th>
 	</tr>