diff --git a/www/js/jquery/form/zentao.js b/www/js/jquery/form/zentao.js index 084da23c92..b92cb82722 100644 --- a/www/js/jquery/form/zentao.js +++ b/www/js/jquery/form/zentao.js @@ -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 = '
'; + errorMSG += '
'; errorMSG += $.type(value) == 'string' ? value : value.join(';'); errorMSG += '
'; - /* 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)}); } },