← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3000: separated validation in addRoleForm

 

------------------------------------------------------------
revno: 3000
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-10 18:04:53 +0100
message:
  separated validation in addRoleForm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.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-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2011-01-20 22:08:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addRoleForm.vm	2011-03-10 17:04:53 +0000
@@ -1,18 +1,29 @@
 <script>
 	jQuery(document).ready(	function(){
 		jQuery("#name").focus();
-		validation( 'addRoleForm', function( form ){
+
+		var rules = {
+			name: {required:true,minlength:2},
+			description: {required:true}
+		}
+
+		validation2( 'addRoleForm', function( form ) {
 			selectAllById( 'selectedList' );
 			selectAllById( 'selectedListAuthority' );
-			form.submit();			
-		});					
+			form.submit();	
+		}, {
+			'rules': rules
+		});
+
+		jQuery("#name").attr("maxlength", "160");
+
+		/* remote validation */
 		checkValueIsExist( "name", "validateRole.action");
 	});		
 </script>
 
 <h3>$i18n.getString( "create_new_user_role" )</h3>
 
-
 <form id="addRoleForm" name="addRoleForm" action="addRole.action" method="post" >
   <table>
 	<tr>
@@ -20,13 +31,13 @@
 	</tr>
 	<tr>
 		<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="name" name="name" style="width:20em" maxlength="160" class="{validate:{required:true,minlength:2}}"/></td>
+		<td><input type="text" id="name" name="name" style="width:20em"></td>
 		<td></td>
 		<td></td>
 	</tr>
 	<tr>
 		<td><label for="description">$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="description" name="description" style="width:20em" class="{validate:{required:true}}"/></td>
+		<td><input type="text" id="description" name="description" style="width:20em""></td>
 		<td></td>
 		<td></td>
 	</tr>