← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6296: (patient) Move js methods from vm file.

 

------------------------------------------------------------
revno: 6296
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-03-19 16:35:42 +0700
message:
  (patient) Move js methods from vm file.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addCaseAggregationForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js
  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/addPatientChartForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramAttributeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addRelationshipTypeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addValidationCriteria.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateCaseAggregationForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.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/javascript/updatePatientChartForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramAttributeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateRelationshipTypeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateValidationCriteria.js
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
  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/addPatientChartForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipTypeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm
  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/updatePatientChartForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateRelationshipTypeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.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-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm	2012-02-27 06:09:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm	2012-03-19 09:35:42 +0000
@@ -50,7 +50,9 @@
 							<td>$dataValue.value</td>
 							<td>$!mapStatusValues.get( $statusKey )</td>
 							<td>
+								#if( $mapCaseAggCondition.get($dataValue).id )
 								<a href='javascript:viewResultDetails($orgunit.id, "$period.periodType.name", "$format.formatDate($period.startDate)",$mapCaseAggCondition.get($dataValue).id)' title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+								#end
 							</td>
 						</tr>
 						#set( $mark = !$mark  )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm	2012-03-19 07:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm	2012-03-19 09:35:42 +0000
@@ -1,12 +1,4 @@
-<script>
-	jQuery(document).ready(	function(){
-		validation( 'addCaseAggregationForm', function(form){
-			form.submit();
-		}); 
-		
-		checkValueIsExist( "aggregationDataElementId", "validateCaseAggregation.action");
-	});		
-</script>
+<script type="text/javascript" src="javascript/addCaseAggregationForm.js"></script>
 															
 <h3>$i18n.getString( "create_new_case_aggregation_condition" )</h3>
 
@@ -286,11 +278,10 @@
 </form>
 
 <script>
-	byId('description').focus();
-	var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
-	var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )';
-	jQuery("#tabs").tabs();
 	#if( $dataSetId )
 		getDataElementsByDataset();
 	#end
+	
+	var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
+	var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )';
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2012-03-19 09:35:42 +0000
@@ -1,31 +1,4 @@
-<script type="text/javascript">
-	jQuery(document).ready(	function(){
-		validation( 'addPatientAttributeForm', function(form){
-			if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
-				form.submit(i18n_field_is_required);
-			}
-		}, function(){
-			isSubmit = true;
-			
-			var fields = jQuery("#addPatientAttributeForm").serializeArray();
-			jQuery.each(fields, function(i, field) {
-				if(  field.name.match("^attrOption")=='attrOption' && field.value == ""){
-					setInnerHTML("attrMessage", i18n_field_is_required);
-					isSubmit = false;
-				}
-			});
-		}); 
-		
-		jQuery("#attributeComboRow").hide();
-			
-		checkValueIsExist( "name", "validatePatientAttribute.action");
-	});		
-
-	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
-	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
-	var isSubmit = true;
-</script>
-
+<script type="text/javascript" src="javascript/addPatientAttributeForm.js"></script>
 																		
 <h3>$i18n.getString( "create_new_patient_attribute" )</h3>
 <form id="addPatientAttributeForm" action="addPatientAttribute.action" method="post" >
@@ -111,3 +84,9 @@
 <span id='message'></span>
 
 </form>   
+
+<script type="text/javascript">
+	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+	var isSubmit = true;
+</script>

=== 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-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeGroupForm.vm	2012-03-19 09:35:42 +0000
@@ -1,40 +1,5 @@
-<script>
-	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
-	
-	jQuery(document).ready(	function(){
-		
-		jQuery('name').focus();
-		
-		jQuery("#availableAttributes").dhisAjaxSelect({
-			source: 'getProgramAttributeWithoutGroup.action',
-			iterator: 'patientAttributes',
-			connectedTo: 'selectedAttributes',
-			handler: function(item){
-				var option = jQuery( "<option/>" );
-				option.attr( "value", item.id );
-				option.text( item.name );
-				
-				return option;
-			}
-		});
-		
-		
-		validation2( 'addPatientAttributeGroupForm', function(form){
-			form.submit();
-		}, {
-			'beforeValidateHandler' : function()
-			{
-				listValidator( 'memberValidator', 'selectedAttributes' );
-			},
-			'rules' : getValidationRules( 'patientAttributeGroup' )
-		} ); 
-		
-		checkValueIsExist( "name", "validatePatientAttributeGroup.action" );
-		
-		
-	});		
-</script>
-	
+<script type="text/javascript" src="javascript/addPatientAttributeGroupForm.js"></script>
+
 <h3>$i18n.getString( "create_new_patient_attribute_group" )</h3>
 																			
 <form id="addPatientAttributeGroupForm" action="addPatientAttributeGroup.action" method="post" >
@@ -90,4 +55,8 @@
 	</tr>
 </table>
 
-</form>
\ No newline at end of file
+</form>
+
+<script>
+	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientChartForm.vm	2012-03-19 09:35:42 +0000
@@ -1,13 +1,4 @@
-<script type="text/javascript">
-	jQuery(document).ready(	function(){
-		validation( 'addPatientChartForm', function( form ){			
-			form.submit();
-		});	
-		checkValueIsExist( "title", "validatePatientChart.action");
-	});		
-
-    var i18n_must_select_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_one_dataelement" ), "'")';
-</script>
+<script type="text/javascript" src="javascript/addPatientChartForm.js"></script>
 
 <h3>$i18n.getString( "create_new_patient_chart" )</h3>
 
@@ -81,3 +72,8 @@
 </form>
 
 <span id="message"></span>
+
+<script type="text/javascript">
+    var i18n_must_select_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_one_dataelement" ), "'")';
+</script>
+

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientIdentifierTypeForm.vm	2012-03-19 09:35:42 +0000
@@ -1,15 +1,4 @@
-<script>
-	jQuery(document).ready(	function(){
-			
-		jQuery('name').focus();
-		
-		validation( 'addPatientIdentifierTypeForm', function(form){
-			form.submit();
-		}); 
-		
-		checkValueIsExist( "name", "validatePatientIdentifierType.action");			
-	});		
-</script>
+<script type="text/javascript" src="javascript/addPatientIdentifierTypeForm.js"></script>
 
 <h3>$i18n.getString( "create_new_patient_identifier_type" )</h3>
 								

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramAttributeForm.vm	2012-03-19 09:35:42 +0000
@@ -1,31 +1,4 @@
-<script>
-	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
-	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
-	var i18n_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
-
-	var isSubmit = true;
-	jQuery(document).ready(	function(){
-			
-			validation( 'addProgramAttributeForm', function(form){
-				if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
-					form.submit();
-				}
-			}, function(){
-				isSubmit = true;
-				jQuery.each($('#addProgramAttributeForm').serializeArray(), function(i, field) {
-					if( field.value == ""){
-						setInnerHTML("attrMessage", i18n_field_is_required);
-						isSubmit = false;
-					}
-				});
-			});
-		
-		jQuery("#attributeComboRow").hide();
-			
-		checkValueIsExist( "name", "validateProgramAttribute.action");
-	});		
-</script>
-
+<script type="text/javascript" src="javascript/addProgramAttributeForm.js"></script>
 																		
 <h3>$i18n.getString( "create_new_program_attribute" )</h3>
 <form id="addProgramAttributeForm" action="addProgramAttribute.action" method="post" >
@@ -37,19 +10,19 @@
 	
     <tbody>
 		<tr>
-			<td width="20em"><label>$i18n.getString( "name" )</label></td>
-			<td><input type="text" id="name" name="name" /></td>
+			<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+			<td><input type="text" id="name" name="name" class="{validate:{required:true}}"/></td>
 			<td></td>
 		</tr>   
 		
 		<tr>
-			<td width="20em" ><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+			<td><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 			<td><input type="text" id="description" name="description" class="{validate:{required:true,minlength:2}}"/></td>
 			<td></td>
 		</tr>
 		
 		<tr>
-			<td width="20em"><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+			<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 			<td>
 				<select id="valueType" name="valueType" onchange="ATTRIBUTE_OPTION.selectValueType(this);">
 					<option value="NUMBER" selected="selected">$i18n.getString( "number" )</option>
@@ -63,7 +36,7 @@
 		</tr>
 		
 		<tr id="attributeComboRow"> 
-			<td width="20em"><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+			<td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 			<td ><table id="attrOptionContainer"></table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a>
 			</td>
 			<td><span id="attrMessage"  name="attrMessage" style="color:red;"></span></td>
@@ -78,4 +51,12 @@
 	</tr>
 </table>
 
-</form>   
+</form>  
+
+<script>
+	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+	var i18n_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
+
+	var isSubmit = true;
+</script> 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm	2012-03-19 09:35:42 +0000
@@ -1,13 +1,4 @@
-<script>
-	jQuery(document).ready(	function(){
-		validation( 'addProgramForm', function( form ){		
-			enable('dateOfEnrollmentDescription');
-			form.submit();
-		});				
-		
-		checkValueIsExist( "name", "validateProgram.action");
-	});		
-</script>
+<script type="text/javascript" src="javascript/addProgramForm.js"></script>
 
 <h3>$i18n.getString( "create_new_program" )</h3>
 									

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2012-03-19 09:35:42 +0000
@@ -1,20 +1,4 @@
 <script type="text/javascript" src="javascript/addProgramStageForm.js"></script>
-<script type="text/javascript">
-	jQuery(function() {
-		jQuery("#availableList").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataElements.action?domain=patient",
-			iterator: "dataElements",
-			connectedTo: 'selectedDataElementsValidator',
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-
-				return option;
-			}
-		});
-	});
-</script>
 
 <h3>$i18n.getString( "create_new_program_stage" )</h3>
 																		

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipTypeForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipTypeForm.vm	2012-03-19 09:35:42 +0000
@@ -1,13 +1,4 @@
-<script>
-	jQuery(document).ready(	function(){
-		
-		jQuery('aIsToB').focus();
-			
-		validation( 'addRelationshipTypeForm', function(form){
-			validateAddRelationshipType();
-		}); 
-	});		
-</script>
+<script type="text/javascript" src="javascript/addRelationshipTypeForm.js"></script>
 
 <h3>$i18n.getString( "create_new_relationship_type" )</h3>
 																					

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2011-09-29 04:17:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addValidationCriteria.vm	2012-03-19 09:35:42 +0000
@@ -1,15 +1,4 @@
-<script>
-	jQuery(document).ready(
-		function()
-		{
-			validation( 'validationCriteriaForm', function( form ){
-				form.submit();			
-			});
-					
-			checkValueIsExist( "name", "validateValidationCriteria.action");
-		}
-	);	
-</script>																
+<script type="text/javascript" src="javascript/addValidationCriteria.js"></script>																
 
 <h3>$i18n.getString( "create_validation_criteria" )</h3>
 <form id="validationCriteriaForm" action="addValidationCriteria.action" method="post" >

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addCaseAggregationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addCaseAggregationForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addCaseAggregationForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,9 @@
+jQuery(document).ready(	function(){
+	validation( 'addCaseAggregationForm', function(form){
+		form.submit();
+	});
+	
+	jQuery("#tabs").tabs();
+	checkValueIsExist( "aggregationDataElementId", "validateCaseAggregation.action");
+	byId('description').focus();
+});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,21 @@
+jQuery(document).ready(	function(){
+		validation( 'addPatientAttributeForm', function(form){
+			if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+				form.submit(i18n_field_is_required);
+			}
+		}, function(){
+			isSubmit = true;
+			
+			var fields = jQuery("#addPatientAttributeForm").serializeArray();
+			jQuery.each(fields, function(i, field) {
+				if(  field.name.match("^attrOption")=='attrOption' && field.value == ""){
+					setInnerHTML("attrMessage", i18n_field_is_required);
+					isSubmit = false;
+				}
+			});
+		}); 
+		
+		jQuery("#attributeComboRow").hide();
+			
+		checkValueIsExist( "name", "validatePatientAttribute.action");
+	});	
\ No newline at end of file

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientAttributeGroupForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,32 @@
+jQuery(document).ready(	function(){
+		
+		jQuery('name').focus();
+		
+		jQuery("#availableAttributes").dhisAjaxSelect({
+			source: 'getProgramAttributeWithoutGroup.action',
+			iterator: 'patientAttributes',
+			connectedTo: 'selectedAttributes',
+			handler: function(item){
+				var option = jQuery( "<option/>" );
+				option.attr( "value", item.id );
+				option.text( item.name );
+				
+				return option;
+			}
+		});
+		
+		
+		validation2( 'addPatientAttributeGroupForm', function(form){
+			form.submit();
+		}, {
+			'beforeValidateHandler' : function()
+			{
+				listValidator( 'memberValidator', 'selectedAttributes' );
+			},
+			'rules' : getValidationRules( 'patientAttributeGroup' )
+		} ); 
+		
+		checkValueIsExist( "name", "validatePatientAttributeGroup.action" );
+		
+		
+	});		
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientChartForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientChartForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientChartForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,6 @@
+jQuery(document).ready(	function(){
+	validation( 'addPatientChartForm', function( form ){			
+		form.submit();
+	});	
+	checkValueIsExist( "title", "validatePatientChart.action");
+});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addPatientIdentifierTypeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,10 @@
+jQuery(document).ready(	function(){
+			
+	jQuery('name').focus();
+	
+	validation( 'addPatientIdentifierTypeForm', function(form){
+		form.submit();
+	}); 
+	
+	checkValueIsExist( "name", "validatePatientIdentifierType.action");			
+});		
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramAttributeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramAttributeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,20 @@
+jQuery(document).ready(	function(){
+		
+	validation( 'addProgramAttributeForm', function(form){
+		if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+			form.submit();
+		}
+	}, function(){
+		isSubmit = true;
+		jQuery.each($('#addProgramAttributeForm').serializeArray(), function(i, field) {
+			if( field.value == ""){
+				setInnerHTML("attrMessage", i18n_field_is_required);
+				isSubmit = false;
+			}
+		});
+	});
+	
+	jQuery("#attributeComboRow").hide();
+		
+	checkValueIsExist( "name", "validateProgramAttribute.action");
+});		
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,8 @@
+jQuery(document).ready(	function(){
+	validation( 'addProgramForm', function( form ){		
+		enable('dateOfEnrollmentDescription');
+		form.submit();
+	});				
+	
+	checkValueIsExist( "name", "validateProgram.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/addProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2011-07-05 03:55:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2012-03-19 09:35:42 +0000
@@ -17,6 +17,18 @@
 		});
 	});
 	
+	jQuery("#availableList").dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getDataElements.action?domain=patient",
+			iterator: "dataElements",
+			connectedTo: 'selectedDataElementsValidator',
+			handler: function(item) {
+				var option = jQuery("<option />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+
+				return option;
+			}
+		});
+		
 	checkValueIsExist( "name", "validateProgramStage.action");	
 });
-

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addRelationshipTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addRelationshipTypeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addRelationshipTypeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,8 @@
+jQuery(document).ready(	function(){
+
+	jQuery('aIsToB').focus();
+		
+	validation( 'addRelationshipTypeForm', function(form){
+		validateAddRelationshipType();
+	}); 
+});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addValidationCriteria.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addValidationCriteria.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addValidationCriteria.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,9 @@
+jQuery(document).ready(
+	function()
+	{
+		validation( 'validationCriteriaForm', function( form ){
+			form.submit();			
+		});
+				
+		checkValueIsExist( "name", "validateValidationCriteria.action");
+});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateCaseAggregationForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateCaseAggregationForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateCaseAggregationForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,12 @@
+jQuery(document).ready(	function(){
+	
+	validation( 'updateCaseAggregationForm', function(form){
+		form.submit();
+	}); 
+	
+	checkValueIsExist( "aggregationDataElementId", "validateCaseAggregation.action", {id:getFieldValue('id')});
+	
+	byId('description').focus();
+	jQuery("#tabs").tabs();
+		
+});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,19 @@
+jQuery(document).ready(	function(){
+	validation( 'updatePatientAttributeForm', function(form){
+		if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+			form.submit(i18n_field_is_required);
+		}
+	}, function(){
+		isSubmit = true;
+		
+		var fields = $("#addPatientAttributeForm").serializeArray();
+		jQuery.each(fields, function(i, field) {
+			if(  field.name.match("^attrOption")=='attrOption' && field.value == ""){
+				setInnerHTML("attrMessage", i18n_field_is_required);
+				isSubmit = false;
+			}
+		});
+	});
+	
+	checkValueIsExist( "name", "validatePatientAttribute.action", {id:getFieldValue('id')});
+});		
\ No newline at end of file

=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientAttributeGroupForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,29 @@
+jQuery(document).ready(	function() {
+	
+	jQuery('name').focus();
+
+	validation2( 'updatePatientAttributeGroupForm', function(form){
+		form.submit();
+	}, {
+		'beforeValidateHandler' : function()
+		{
+			listValidator( 'memberValidator', 'selectedAttributes' );
+		},
+		'rules' : getValidationRules( 'patientAttributeGroup' )
+	});
+
+	checkValueIsExist( "name", "validatePatientAttributeGroup.action", {id:getFieldValue('id')});
+	
+	jQuery("#availableAttributes").dhisAjaxSelect({
+		source: 'getProgramAttributeWithoutGroup.action',
+		iterator: 'patientAttributes',
+		connectedTo: 'selectedAttributes',
+		handler: function(item){
+			var option = jQuery( "<option/>" );
+			option.attr( "value", item.id );
+			option.text( item.name );
+			
+			return option;
+		}
+	});
+});		
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientChartForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientChartForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientChartForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,7 @@
+jQuery(document).ready(	function(){
+	validation( 'updatePatientChartForm', function( form ){			
+		form.submit();
+	});			
+
+	checkValueIsExist( "title", "validatePatientChart.action", {id:'$patientChart.id'});	
+});		

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updatePatientIdentifierTypeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,10 @@
+jQuery(document).ready(	function(){
+	
+	jQuery('name').focus();
+	
+	validation( 'updatePatientIdentifierTypeForm', function(form){
+		form.submit();
+	}); 
+	
+	checkValueIsExist( "name", "validatePatientIdentifierType.action", {id:getFieldValue('id')});
+});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramAttributeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramAttributeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,18 @@
+jQuery(document).ready(	function(){
+			
+	validation( 'updateProgramAttributeForm', function(form){
+		if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+			form.submit();
+		}
+	}, function(){
+		isSubmit = true;
+		jQuery.each($('#updateProgramAttributeForm').serializeArray(), function(i, field) {
+			if( field.value == ""){
+				setInnerHTML("attrMessage", i18n_field_is_required);
+				isSubmit = false;
+			}
+		});
+	}); 
+		
+	checkValueIsExist( "name", "validateProgramAttribute.action", {id:getFieldValue('id')});
+});		
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,9 @@
+jQuery(document).ready(	function(){
+
+	validation( 'updateProgramForm', function( form ){ 
+		enable('dateOfEnrollmentDescription');
+		form.submit();			
+	});	
+	
+	checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')});
+});	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js	2012-03-07 02:40:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js	2012-03-19 09:35:42 +0000
@@ -1,24 +1,23 @@
-jQuery( document ).ready( function()
-{
-	validation( 'updateProgramStageForm', function( form ){ 
-		form.submit() ;
-	}, function(){
-		selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
-		selectedDataElementsValidator.empty();
-		
-		compulsories = jQuery( "#compulsories" );
-		compulsories.empty();
-		
-		jQuery("#selectedList").find("tr").each( function( i, item ){ 
-			selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-			var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
-			var isShow = jQuery( item ).find( "input[name='isShow']:first");
-
-			var checked = compulsory.attr('checked') ? true : false;
-			compulsories.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+jQuery(function() {
+		jQuery("#availableList").dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getDataElements.action?domain=patient",
+			iterator: "dataElements",
+			connectedTo: 'selectedDataElementsValidator',
+			handler: function(item) {
+				var option = jQuery("<option />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+				
+				var flag = false;
+				jQuery("#selectedList").find("tr").each( function( k, selectedItem ){ 
+					if(selectedItem.id == item.id )
+					{
+						flag = true;
+						return;
+					}
+				});
+				
+				if(!flag) return option;
+			}
 		});
-	});
-	
-	checkValueIsExist( "name", "validateProgramStage.action", {id:getFieldValue('id')});	
-});
-
+	});
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateRelationshipTypeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateRelationshipTypeForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateRelationshipTypeForm.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,9 @@
+jQuery(document).ready(	function(){
+		
+		jQuery('aIsToB').focus();
+			
+		validation( 'updateRelationshipTypeForm', function(form){
+			validateUpdateRelationshipType();
+		}); 
+		
+	});	
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateValidationCriteria.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateValidationCriteria.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateValidationCriteria.js	2012-03-19 09:35:42 +0000
@@ -0,0 +1,9 @@
+jQuery(document).ready(
+	function()
+		{
+			validation( 'validationCriteriaForm', function( form ){			
+				form.submit();
+			});
+	
+		checkValueIsExist( "name", "validateValidationCriteria.action", {id:getFieldValue('id')});
+});
\ 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/updateCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm	2012-03-19 07:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm	2012-03-19 09:35:42 +0000
@@ -1,27 +1,5 @@
-<script>
-	jQuery(document).ready(	function(){
-	
-		validation( 'updateCaseAggregationForm', function(form){
-			form.submit();
-		}); 
-		
-		checkValueIsExist( "aggregationDataElementId", "validateCaseAggregation.action", {id:getFieldValue('id')});
-		
-		byId('description').focus();
-		var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
-		var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )';
-		jQuery("#tabs").tabs();
-		
-	});	
-	
-	#if( $dataSetId )
-		getDataElementsByDataset();
-		var selectedValue = "$caseAggregation.aggregationDataElement.id" + "." + "$caseAggregation.optionCombo.id";
-		jQuery("#aggregationDataElementId").val( selectedValue );
-		var avasdjl;
-	#end	
-</script>
-														
+<script type="text/javascript" src="javascript/updateCaseAggregationForm.js"></script>
+
 <h3>$i18n.getString( "edit_case_aggregation_condition" )</h3>
 
 <form id="updateCaseAggregationForm" action="updateCaseAggregation.action" method="post" >
@@ -300,3 +278,14 @@
 </table>
 
 </form>
+
+<script>
+	#if( $dataSetId )
+		getDataElementsByDataset();
+		var selectedValue = "$caseAggregation.aggregationDataElement.id" + "." + "$caseAggregation.optionCombo.id";
+		jQuery("#aggregationDataElementId").val( selectedValue );
+	#end	
+	
+	var i18n_run_success = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
+	var i18n_run_fail = '$encoder.jsEscape( $i18n.getString( "run_fail" ) , "'" )';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2012-03-19 09:35:42 +0000
@@ -1,32 +1,4 @@
-<script>
-	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
-	var i118_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
-	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
-	var isSubmit = true;
-	
-	jQuery(document).ready(	function(){
-
-			validation( 'updatePatientAttributeForm', function(form){
-				if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
-					form.submit(i18n_field_is_required);
-				}
-			}, function(){
-				isSubmit = true;
-				
-				var fields = $("#addPatientAttributeForm").serializeArray();
-				jQuery.each(fields, function(i, field) {
-					if(  field.name.match("^attrOption")=='attrOption' && field.value == ""){
-						setInnerHTML("attrMessage", i18n_field_is_required);
-						isSubmit = false;
-					}
-				});
-			});
-			
-			checkValueIsExist( "name", "validatePatientAttribute.action", {id:getFieldValue('id')});
-
-	});		
-</script>
-
+<script type="text/javascript" src="javascript/updatePatientAttributeForm.js"></script>
 
 <h3>$i18n.getString( "edit_patient_attribute" )</h3>
 
@@ -132,4 +104,9 @@
 	{
 		jQuery("#attributeComboRow").hide();
 	}
+	
+	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+	var i118_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
+	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+	var isSubmit = true;	
 </script>

=== 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-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteGroupForm.vm	2012-03-19 09:35:42 +0000
@@ -1,36 +1,5 @@
-<script>
-	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
-
-	jQuery(document).ready(	function() {
-	
-		jQuery('name').focus();
-
-		validation2( 'updatePatientAttributeGroupForm', function(form){
-			form.submit();
-		}, {
-			'beforeValidateHandler' : function()
-			{
-				listValidator( 'memberValidator', 'selectedAttributes' );
-			},
-			'rules' : getValidationRules( 'patientAttributeGroup' )
-		} );
-
-		checkValueIsExist( "name", "validatePatientAttributeGroup.action", {id:getFieldValue('id')});
-		
-		jQuery("#availableAttributes").dhisAjaxSelect({
-			source: 'getProgramAttributeWithoutGroup.action',
-			iterator: 'patientAttributes',
-			connectedTo: 'selectedAttributes',
-			handler: function(item){
-				var option = jQuery( "<option/>" );
-				option.attr( "value", item.id );
-				option.text( item.name );
-				
-				return option;
-			}
-		});
-	});		
-</script>
+<script type="text/javascript" src="javascript/updatePatientAttributeGroupForm.js"></script>
+
 <h3>$i18n.getString( "edit_patient_attribute_group" )</h3>
 <form id="updatePatientAttributeGroupForm" name="updatePatientAttributeGroupForm" action="updatePatientAttributeGroup.action" method="post" >
 
@@ -94,8 +63,10 @@
 			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='patientAttributeGroup.action'" />
 		</td>
 	</tr>
-</table>  
-
-
+</table> 
 
 </form>     
+
+<script>
+	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientChartForm.vm	2012-03-19 09:35:42 +0000
@@ -1,14 +1,4 @@
-<script type="text/javascript">
-	jQuery(document).ready(	function(){
-		validation( 'updatePatientChartForm', function( form ){			
-			form.submit();
-		});			
-	
-		checkValueIsExist( "title", "validatePatientChart.action", {id:'$patientChart.id'});	
-	});		
-
-    var i18n_must_select_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_one_dataelement" ), "'")';
-</script>
+<script type="text/javascript" src="javascript/updatePatientChartForm.js"></script>
 
 <h3>$i18n.getString( "edit_patient_chart" )</h3>
 
@@ -81,3 +71,7 @@
 </form>
 
 <span id="message"></span>
+
+<script type="text/javascript">
+    var i18n_must_select_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_one_dataelement" ), "'")';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientIdentifierType.vm	2012-03-19 09:35:42 +0000
@@ -1,16 +1,4 @@
-<script>
-	jQuery(document).ready(	function(){
-		
-		jQuery('name').focus();
-			
-		validation( 'updatePatientIdentifierTypeForm', function(form){
-			form.submit();
-		}); 
-		
-		checkValueIsExist( "name", "validatePatientIdentifierType.action", {id:getFieldValue('id')});
-	});		
-</script>
-
+<script type="text/javascript" src="javascript/updatePatientIdentifierTypeForm.js"></script>
 
 <h3>$i18n.getString( "edit_patient_identifier_type" )</h3>
 									

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramAttributeForm.vm	2012-03-19 09:35:42 +0000
@@ -1,28 +1,4 @@
-<script>
-	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
-	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
-	var i18n_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
-	var isSubmit = true;
-	jQuery(document).ready(	function(){
-			
-			validation( 'updateProgramAttributeForm', function(form){
-				if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
-					form.submit();
-				}
-			}, function(){
-				isSubmit = true;
-				jQuery.each($('#updateProgramAttributeForm').serializeArray(), function(i, field) {
-					if( field.value == ""){
-						setInnerHTML("attrMessage", i18n_field_is_required);
-						isSubmit = false;
-					}
-				});
-			}); 
-			
-		checkValueIsExist( "name", "validateProgramAttribute.action", {id:getFieldValue('id')});
-	});		
-</script>
-
+<script type="text/javascript" src="javascript/updateProgramAttributeForm.js"></script>
 																		
 <h3>$i18n.getString( "edit_program_attribute" )</h3>
 <form id="updateProgramAttributeForm" action="updateProgramAttribute.action" method="post" >
@@ -34,13 +10,13 @@
     <tbody>
 	
     <tr>
-        <td width="20em"><label>$i18n.getString( "name" )</label></td>
-        <td><input type="text" id="name" name="name" value='$programAttribute.name' /></td>
+        <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+        <td><input type="text" id="name" name="name" value='$programAttribute.name' class="{validate:{required:true}}" /></td>
         <td></td>
     </tr>   
     
     <tr>
-        <td width="20em" ><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+        <td><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
         <td><input type="text" id="description" name="description" value='$programAttribute.description' class="{validate:{required:true,minlength:2}}"/></td>
         <td></td>
     </tr>
@@ -92,4 +68,9 @@
 	}else{
 		jQuery("#attributeComboRow").hide();
 	}
+	
+	var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+	var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+	var i18n_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
+	var isSubmit = true;
 </script>
\ 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/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2012-03-19 09:35:42 +0000
@@ -1,17 +1,4 @@
-<link rel="stylesheet" type="text/css" href="style/basic.css" media="screen" />
-<script>
-	jQuery(document).ready(	function(){
-		
-		validation( 'updateProgramForm', function( form ){ 
-			enable('dateOfEnrollmentDescription');
-			form.submit();			
-		});	
-		
-		checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')});
-
-	});		
-</script>
-
+<script type="text/javascript" src="javascript/updateProgramForm.js"></script>
 
 <h3>$i18n.getString( "edit_program" )</h3>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2012-03-19 09:35:42 +0000
@@ -1,29 +1,4 @@
 <script type="text/javascript" src="javascript/updateProgramStageForm.js"></script>
-<script type="text/javascript">
-	jQuery(function() {
-		jQuery("#availableList").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataElements.action?domain=patient",
-			iterator: "dataElements",
-			connectedTo: 'selectedDataElementsValidator',
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.name );
-				option.attr( "value", item.id );
-				
-				var flag = false;
-				jQuery("#selectedList").find("tr").each( function( k, selectedItem ){ 
-					if(selectedItem.id == item.id )
-					{
-						flag = true;
-						return;
-					}
-				});
-				
-				if(!flag) return option;
-			}
-		});
-	});
-</script>
 
 <h3>$i18n.getString( "edit_program_stage" )</h3>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateRelationshipTypeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateRelationshipTypeForm.vm	2012-03-15 09:28:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateRelationshipTypeForm.vm	2012-03-19 09:35:42 +0000
@@ -1,14 +1,4 @@
-<script>
-	jQuery(document).ready(	function(){
-		
-		jQuery('aIsToB').focus();
-			
-		validation( 'updateRelationshipTypeForm', function(form){
-			validateUpdateRelationshipType();
-		}); 
-		
-	});		
-</script>
+<script type="text/javascript" src="javascript/updateRelationshipTypeForm.js"></script>
 
 <h3>$i18n.getString( "edit_relationship_type" )</h3>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2011-09-29 04:17:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateValidationCriteria.vm	2012-03-19 09:35:42 +0000
@@ -1,17 +1,4 @@
-<script>
-
-	jQuery(document).ready(
-		function()
-			{
-				validation( 'validationCriteriaForm', function( form ){			
-					form.submit();
-				});
-		
-			checkValueIsExist( "name", "validateValidationCriteria.action", {id:getFieldValue('id')});
-		}
-	);
-	
-</script>													
+<script type="text/javascript" src="javascript/updateValidationCriteria.js"></script>																
 
 <h3>$i18n.getString( "edit_validation_criteria" )</h3>