← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2702: Form Validation Added in Graphical Analysis/Target in DataAnalyser

 

------------------------------------------------------------
revno: 2702
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-01-21 17:39:47 +0530
message:
  Form Validation Added in Graphical Analysis/Target in DataAnalyser
modified:
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js
  local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.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 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js	2011-01-17 06:56:53 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/javascript/tr.js	2011-01-21 12:09:47 +0000
@@ -128,4 +128,53 @@
 {
     var o = document.getElementById('overlay');
     o.style.visibility = 'hidden';
-}
\ No newline at end of file
+}
+
+//formValidationsForDeTarget Function Start
+function formValidationsForDeTarget()
+{
+	
+	var avlDEListSize  = document.targetAnalysisForm.availableDataElements.options.length;//alert(selDEListSize);
+	
+	//var selOUListLength = document.ChartGenerationForm.orgUnitListCB.options.length;//alert(selOUListLength);
+	var orgUnitGroupListCB = document.getElementById("orgUnitGroupList");
+    
+    sDateIndex    = document.getElementById("sDateLB").selectedIndex;
+    eDateIndex    = document.getElementById("eDateLB").selectedIndex;
+    sDateTxt = document.getElementById("sDateLB").options[sDateIndex].text;
+    sDate = formatDate(new Date(getDateFromFormat(sDateTxt,"MMM-y")),"yyyy-MM-dd");
+    eDateTxt = document.getElementById("eDateLB").options[eDateIndex].text;
+    eDate = formatDate(new Date(getDateFromFormat(eDateTxt,"MMM-y")),"yyyy-MM-dd");
+
+   
+    
+    if(avlDEListSize <= 0 ){alert( "Please Select DataElement" );return false;}
+    else if(sDateIndex < 0) {alert("Please Select Starting Period");return false;}
+    else if(eDateIndex < 0) {alert("Please Select Ending Period");return false;}
+    else if(sDate > eDate) {alert("Starting Date is Greater");return false;}
+    else if(document.targetAnalysisForm.ouNameTB.value == "" || document.getElementById("ouNameTB") == null ){alert( "Please Select OrganisationUnit" );return false;}
+    
+    else if(document.getElementById( 'ougGroupSetCB' ).checked && orgUnitGroupListCB.selectedIndex < 0 ) 
+	{
+		alert( "Please select OrgUnitGroup" );
+		return false;
+    
+	}
+    
+    var sWidth = 850;
+	var sHeight = 650;
+    var LeftPosition=(screen.width)?(screen.width-sWidth)/2:100;
+    var TopPosition=(screen.height)?(screen.height-sHeight)/2:100;
+
+    window.open('','chartWindow1','width=' + sWidth + ', height=' + sHeight + ', ' + 'left=' + LeftPosition + ', top=' + TopPosition + ', ' + 'location=no, menubar=no, ' +  'status=no, toolbar=no, scrollbars=yes, resizable=yes');
+
+    return true;
+	
+}    
+// formValidationsForDeTarget Function End
+
+
+
+
+
+

=== modified file 'local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.vm'
--- local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.vm	2011-01-17 06:56:53 +0000
+++ local/in/dhis-web-dashboard/src/main/webapp/dhis-web-dashboard/targetAnalysisFront.vm	2011-01-21 12:09:47 +0000
@@ -14,7 +14,7 @@
 <h1>Target Analysis Form</h1>
 <hr /><br/>
 
-<form id="targetAnalysisForm" name="targetAnalysisForm" action="generateChartDeTarget.action" method="post" onsubmit="return formValidations()" target="chartWindow1">
+<form id="targetAnalysisForm" name="targetAnalysisForm" action="generateChartDeTarget.action" method="post" onsubmit="return formValidationsForDeTarget()" target="chartWindow1">
 	<table align="center" style=" border-collapse: collapse; margin-top: 0;" cellpadding="0" cellspacing="0" width="100%" border=0>
   	    <tr>
 			<td class="NormalB">