dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11442
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3262: Re-enabled check for username. Made modifications to jquery.validation to make it compatible with...
------------------------------------------------------------
revno: 3262
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-01 22:21:05 +0200
message:
Re-enabled check for username. Made modifications to jquery.validation to make it compatible with the json returned from our server-side validation routines.
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js
--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js 2011-03-31 20:00:11 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.js 2011-04-01 20:21:05 +0000
@@ -11,6 +11,10 @@
* http://www.gnu.org/licenses/gpl.html
*/
+/*
+ * Modified for v1.8 by mortenoh, based on custom code from Viet Nguyen
+ */
+
(function($) {
$.extend($.fn, {
@@ -52,14 +56,13 @@
// prevent form submit to be able to see console output
event.preventDefault();
- // This was readded for jquery.validation 1.8 by mortenoh
- // original code by Viet Nguyen
- // TODO this should be either removed completely (big job), or maybe added somewhere else..
+ /* -- Custom code by mortenoh -- */
if(validator.settings.beforeValidateHandler)
{
validator.settings.beforeValidateHandler.call();
}
-
+ /* -- end -- */
+
function handle() {
if ( validator.settings.submitHandler ) {
if (validator.submitButton) {
@@ -259,11 +262,13 @@
$.extend( $.validator.defaults, settings );
},
+ /* -- Custom code by mortenoh -- */
setMessages : function( messages ) {
this.messages = messages;
},
messages: {},
+ /* -- end -- */
autoCreateRanges: false,
@@ -938,7 +943,12 @@
data: data,
success: function(response) {
validator.settings.messages[element.name].remote = previous.originalMessage;
- var valid = response === true;
+
+ /* -- Custom code by mortenoh -- */
+ //var valid = response === true; // OLD
+ var valid = response.response === 'success';
+ /* -- end -- */
+
if ( valid ) {
var submitted = validator.formSubmitted;
validator.prepareElement(element);
@@ -947,7 +957,11 @@
validator.showErrors();
} else {
var errors = {};
- var message = response || validator.defaultMessage( element, "remote" );
+ /* -- Custom code by mortenoh -- */
+ //var message = response || validator.defaultMessage( element, "remote" ); // OLD
+ var message = (previous.message = response.message || validator.defaultMessage( element, "remote" ));
+ /* -- end -- */
+
errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
validator.showErrors(errors);
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js 2011-04-01 19:11:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js 2011-04-01 20:21:05 +0000
@@ -59,7 +59,7 @@
jQuery( "#phoneNumber" ).attr( "maxlength", r.user.phone.rangelength[1] );
/* remote validation */
- /* checkValueIsExist( "username", "validateUser.action" ); */
+ checkValueIsExist( "username", "validateUser.action" );
jQuery("#cancel").click(function() {
referrerBack( "alluser.action" );