← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6251: Remove jQuery validation for comparing start date and end date in report and use datePickerInRang...

 

------------------------------------------------------------
revno: 6251
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-03-12 20:38:39 +0700
message:
  Remove jQuery validation for comparing start date and end date in report and use datePickerInRange to validate.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/messages.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties


--
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/tabularReportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.vm	2012-03-12 08:10:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/tabularReportSelect.vm	2012-03-12 13:38:39 +0000
@@ -1,13 +1,15 @@
 <script>
 	jQuery(document).ready(	function(){
-			validation2( 'reportForm', function(form){
-				validateTabularReport();
-			}, {
-				'beforeValidateHandler' : function()
-				{
-					listValidator( 'memberValidator', 'dataElementIds' );
-				}
-			} ); 
+		validation2( 'reportForm', function(form){
+			validateTabularReport();
+		}, {
+			'beforeValidateHandler' : function()
+			{
+				listValidator( 'memberValidator', 'dataElementIds' );
+			}
+		} ); 
+
+		datePickerInRange( 'startDate' , 'endDate' );	
 	});		
 </script>
 
@@ -39,20 +41,14 @@
 	<tr>
         <td><label>$i18n.getString( "start_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
         <td colspan='2'>
-            <input type="text" id="startDate" name="startDate" class="{validate:{required:true}}" />
-			<script type="text/javascript">
-				datePicker('startDate');
-            </script>  	
-        </td>
+            <input type="text" id="startDate" name="startDate" />
+		</td>
     </tr>
     
     <tr>
         <td><label>$i18n.getString( "end_date" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
         <td colspan='2'>
-            <input type="text" id="endDate" name="endDate" class="{validate:{required:true, greaterOrEqualsDate:'#startDate' }}" />
-            <script type="text/javascript">
-				datePicker('endDate');
-            </script> 				
+            <input type="text" id="endDate" name="endDate" />
         </td>      
     </tr>
 	

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/messages.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/messages.vm	2012-03-12 07:03:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/messages.vm	2012-03-12 13:38:39 +0000
@@ -48,8 +48,7 @@
         ,letterswithbasicspecialchars: '$encoder.jsEscape($i18n.getString( 'please_letters_numbers_spaces_or_some_special_chars_only' ) , "'")'
         ,lessthanequal: validatorFormat('$encoder.jsEscape($i18n.getString( 'please_enter_a_value_less_than_or_equal_to' ) , "'")')
         ,greaterthanequal: validatorFormat( '$encoder.jsEscape($i18n.getString( 'please_enter_a_value_greater_than_or_equal_to' ) , "'")' )
-		,greaterOrEqualsDate: validatorFormat( '$encoder.jsEscape($i18n.getString( 'please_enter_a_value_greater_than_or_equal_to_start_date' ) , "'")' )
-        ,unique: '$encoder.jsEscape($i18n.getString( 'please_do_not_enter_same_values' ) , "'")'
+		,unique: '$encoder.jsEscape($i18n.getString( 'please_do_not_enter_same_values' ) , "'")'
         ,letterswithbasicpunc: '$encoder.jsEscape($i18n.getString( 'letters_or_punctuation_only_please' ) , "'")'
         ,maxWords : validatorFormat('$encoder.jsEscape($i18n.getString( 'please_enter_n_words_or_less' ) , "'")')
         ,minWords : validatorFormat('$encoder.jsEscape($i18n.getString( 'please_enter_at_least_n_words' ) , "'")')

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js	2012-03-12 07:03:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js	2012-03-12 13:38:39 +0000
@@ -165,18 +165,7 @@
         return true;
 
     }, "");
-	
-jQuery.validator.addMethod("greaterOrEqualsDate",function(value, element, params) {
-        
-		if ($(params).val()){
-			var closedDate = new Date(value);
-			var openDate= new Date($(params).val());
-			return closedDate >= openDate;
-		}
-        return true;
 
-    }, "");
-	
 jQuery.validator.addMethod("alphanumeric", function(value, element) {
     return this.optional(element) || /^[\w\s]+$/i.test(value);
 }, "Letters, numbers, spaces or underscores only please");

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-03-12 07:03:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2012-03-12 13:38:39 +0000
@@ -362,7 +362,6 @@
 please_enter_a_value_between_a_and_b=Please enter a value between {0} and {1}.
 please_enter_a_value_less_than_or_equal_to_n=Please enter a value less than or equal to {0}.
 please_enter_a_value_greater_than_or_equal_to_n=Please enter a value greater than or equal to {0}.
-please_enter_a_value_greater_than_or_equal_to_start_date=Please enter a value greater than or equal to start date.
 please_enter_a_different_value_to_above=Please enter a different value to above.
 digits_decimal_only_please=Please enter digits only. Three digits before decimal point and two after the decimal point are allowed.
 please_letters_numbers_spaces_underscores_only=Only letters, numbers, spaces and underscores are allowed.