jQuery( "#loginForm" ).validate({
onfocusout: function(element) {
if ( !this.checkable(element) ) {
this.element(element);
}
},
rules: {
txtPassword: "required",
txtUsername: "required email"
},
messages: {
txtPassword: "Your password must be at least 8 characters long.",
txtUsername: "Please enter a valid email address"
}
});
//expires: null - expires on browser close
jQuery('#txtUsername').blur(function() {
jQuery.cookie('user_name33c5ab4b6b594735b0035626869dce9a', jQuery('#txtUsername').val(), { expires: null
, path: '/'
//, domain: '10.42.127.108'
});
});
if ( jQuery.cookie('user_name33c5ab4b6b594735b0035626869dce9a') != null ) {
jQuery('#txtUsername').val( jQuery.cookie('user_name33c5ab4b6b594735b0035626869dce9a') );
jQuery.cookie('user_name33c5ab4b6b594735b0035626869dce9a', null, { expires: -1 });
}
jQuery("#btnClose").click( function() {
//jQuery("label.error").hide();
//jQuery(".error").removeClass("error");
jQuery( "#forgottenPasswordForm" ).resetForm();
jQuery.unblockUI();
});
var offsetbtnForgottenPsw = jQuery("#btnForgottenPsw").offset();
var topBtnForgottenPsw = ( offsetbtnForgottenPsw != null ? ( parseInt( offsetbtnForgottenPsw.top ) + 2 ) + 'px' : '0px');
var leftBtnForgottenPsw = ( offsetbtnForgottenPsw != null ? ( parseInt( offsetbtnForgottenPsw.left ) - 25 ) + 'px': '0px');
jQuery("#btnForgottenPsw").click( function() {
jQuery("#loginMsgDiv").hide();
jQuery( "#forgottenPasswordForm" ).resetForm();
jQuery.blockUI( {
// disable horz centering
centerX: false,
// disable vertical centering
centerY: false,
// apply css props as desired
css: { top: topBtnForgottenPsw, left: leftBtnForgottenPsw } ,
message: jQuery("#passWnd")
});
});
jQuery( "#forgottenPasswordForm" ).validate({
//debug: true,
errorContainer: "#forgottenPasswordFormError",
onfocusout: function(element) {
if ( !this.checkable(element) ) {
this.element(element);
}
},
submitHandler: function(form) {
jQuery(form).ajaxSubmit( { success: showForgottenPasswordResponse } );
return false;
},
rules: {
txtEmail: "required email"
},
messages: {
txtEmail: "user_name_validation"
}
});
// post-submit callback
function showForgottenPasswordResponse( responseText, statusText, xhr, $form ) {
// for normal html responses, the first argument to the success callback
// is the XMLHttpRequest object's responseText property
// if the ajaxSubmit method was passed an Options Object with the dataType
// property set to 'xml' then the first argument to the success callback
// is the XMLHttpRequest object's responseXML property
// if the ajaxSubmit method was passed an Options Object with the dataType
// property set to 'json' then the first argument to the success callback
// is the json data object returned by the server
jQuery.unblockUI();
jQuery("#loginMsgDiv").show();
jQuery("#loginMsgDiv").text( responseText );
//jQuery( "#passWndMsgDiv" ).text( responseText );
//jQuery.blockUI( {
// // disable horz centering
// centerX: false,
// // disable vertical centering
// centerY: false,
// // apply css props as desired
// css: { top: topBtnForgottenPsw, left: leftBtnForgottenPsw } ,
// message: jQuery("#passWnd")
//});
}