← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2975: Fix bug: Disable 'Delete this form' button when creating a new dataEntryForm.

 

------------------------------------------------------------
revno: 2975
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-04 09:22:31 +0700
message:
  Fix bug: Disable 'Delete this form' button when creating a new dataEntryForm.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.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-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js	2010-09-16 06:18:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js	2011-03-04 02:22:31 +0000
@@ -53,7 +53,7 @@
   }
   
   var requestString = 'validateDataEntryForm.action';
-  
+
   var params = 'name=' + document.getElementById( 'nameField' ).value;
   
   if(stat == "ADD")
@@ -191,6 +191,7 @@
 				setMessage(i18n_save_success); 
 				stat = "EDIT";
 				dataEntryFormId = xmlObject.firstChild.nodeValue;
+				enable('delete');
 			} );
 	  
 	var params = 'nameField=' + getFieldValue('nameField');

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2011-03-03 06:32:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2011-03-04 02:22:31 +0000
@@ -122,7 +122,17 @@
           <input type="button" name="cancel" value="$i18n.getString( 'cancel' )" onclick="window.location.href='dataSet.action'"/>
         </td>
         <td id="cde_deletebuttoncell">
-          <input type="button" name="delete" value="$i18n.getString( 'delete' )" onclick="removeDataEntryForm( '$dataSet.id', '$dataEntryForm.id', '$dataEntryForm.name' )" #if($!status && $status == "ADD") disabled #end/>
+          <input type="button" id='delete' name="delete" value="$i18n.getString( 'delete' )" onclick="removeDataEntryForm( '$dataSet.id', '$dataEntryForm.id', '$dataEntryForm.name' )"/>
+		  <script>
+			if(stat == "EDIT")
+			{
+				enable('delete');
+			}
+			else
+			{
+				disable('delete');
+			}
+		  </script>
         </td>
         </tr>
 		<tr><td><span id="message"></span></td></tr>