* fix bug #913.
This commit is contained in:
Vendored
+6
-21
@@ -69,38 +69,23 @@ $.extend(
|
||||
if($.type(response.message) == 'object')
|
||||
{
|
||||
var triggered = new Array();
|
||||
var errorMSG = '';
|
||||
var firstOBJ = '';
|
||||
$.each(response.message, function(key, value)
|
||||
{
|
||||
/* Define the id of the error objecjt and it's label. */
|
||||
var errorOBJ = '#' + key;
|
||||
var errorLabel = key + 'Label';
|
||||
var errorLabel = key + 'Label';
|
||||
var i = triggered.push(false);
|
||||
|
||||
/* Create the error message. */
|
||||
var errorMSG = '<div id="' + errorLabel + '" class="text-danger red">';
|
||||
errorMSG += '<div id="' + errorLabel + '" class="text-danger red">';
|
||||
errorMSG += $.type(value) == 'string' ? value : value.join(';');
|
||||
errorMSG += '</div>';
|
||||
|
||||
/* Append error message, set style and set the focus events. */
|
||||
$('#' + errorLabel).remove();
|
||||
$(errorOBJ).parent().append(errorMSG);
|
||||
$(errorOBJ).css('margin-bottom', 0);
|
||||
$(errorOBJ).css('border-color','#D2322D');
|
||||
|
||||
$(errorOBJ).bind('keydown mousedown', function()
|
||||
{
|
||||
if(!triggered[i])
|
||||
{
|
||||
$(this).removeAttr('style')
|
||||
$('#' + errorLabel).remove();
|
||||
triggered[i] = true;
|
||||
}
|
||||
});
|
||||
|
||||
if(i == 1)$(errorOBJ).focus();
|
||||
|
||||
setTimeout(function(){$('#' + errorLabel).remove();}, 5000);
|
||||
if(i == 1)firstOBJ = errorOBJ;
|
||||
})
|
||||
if(errorMSG)bootbox.alert(errorMSG, function(){setTimeout(function(){$('body').click();if(firstOBJ)$(firstOBJ).focus();}, 100)});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user