← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4149: Add validation for report form ( Patient module ).

 

------------------------------------------------------------
revno: 4149
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-07-15 15:28:34 +0700
message:
  Add validation for report form ( Patient module ).
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.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/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2011-07-15 08:07:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2011-07-15 08:28:34 +0000
@@ -3,6 +3,7 @@
 function organisationUnitSelected( orgUnits )
 {
     showLoader();
+	setInnerHTML( 'contentDiv','' );
 	jQuery.postJSON( "getPrograms.action",
 	{
 	}, 
@@ -21,7 +22,7 @@
 		}
 		else
 		{
-			addOptionById( 'programId', "0", i18n_select );
+			addOptionById( 'programId', "", i18n_select );
 			
 			for ( var i in json.programs ) 
 			{

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2011-07-15 08:07:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2011-07-15 08:28:34 +0000
@@ -1,16 +1,23 @@
+<script>
+	jQuery(document).ready(	function(){
+		validation( 'reportForm', function(form){
+			validateAndGenerateReport();
+		}); 
+	});		
+</script>
+
 <h3>$i18n.getString( "report_management" )</h3>
-
 <form id="reportForm" name="reportForm" method="post" action="reportSelect.action">
 <table>	
     <tr>
 	  <td><label>$i18n.getString( "reporting_unit" )</label></td>
-	  <td><input type="text" readonly="readonly" id='orgunitname' name='orgunitname' #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "select" )]" #end style="min-width:350px"></td>
+	  <td><input type="text" readonly="readonly" id='orgunitname' name='orgunitname' value="[$i18n.getString( "select" )]" style="min-width:350px"></td>
     </tr>
     
     <tr>
         <td><label for="programId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
         <td>
-            <select id="programId" name="programId" disabled style="min-width:350px" class="{validate:{required:true}}">
+            <select id="programId" name="programId" disabled style="min-width:350px" class="{validate:{required:true}}" >
             </select>
         </td>
     </tr>
@@ -36,7 +43,7 @@
     </tr>    	                		
 </table>
 <p>
-    <input type="button" id='generateBtn' name='generateBtn' disabled value="$i18n.getString( 'generate' )" style="width:10em" onclick="validateAndGenerateReport()"/>
+    <input type="submit" id='generateBtn' name='generateBtn' disabled value="$i18n.getString( 'generate' )" style="width:10em" />
     <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='index.action'" style="width:10em"/>
 </p>  
 </form>