NIHVIVO-2280: On main account page, If there is no account selected for deletion and the user click on the DELETE button, the page was throwing a js alert displaying, "Are you sure you want to delete this account?". I have fixed this error.

This commit is contained in:
manolobevia 2011-06-09 21:53:15 +00:00
parent 8f995412dd
commit 371997da6f

View file

@ -10,7 +10,6 @@ $(document).ready(function(){
$('#account-display').submit(); $('#account-display').submit();
}); });
//Delete accounts //Delete accounts
//Show is javascript is enable //Show is javascript is enable
$('input:checkbox[name=delete-all]').show(); $('input:checkbox[name=delete-all]').show();
@ -24,7 +23,6 @@ $(document).ready(function(){
// if not checked, deselect all the checkboxes // if not checked, deselect all the checkboxes
$('input:checkbox[name=deleteAccount]').removeAttr('checked'); $('input:checkbox[name=deleteAccount]').removeAttr('checked');
} }
}); });
$('input:checkbox[name=deleteAccount]').click(function(){ $('input:checkbox[name=deleteAccount]').click(function(){
@ -34,7 +32,11 @@ $(document).ready(function(){
// Confirmation alert for account deletion in userAccounts-list.ftl template // Confirmation alert for account deletion in userAccounts-list.ftl template
$('input[name="delete-account"]').click(function(){ $('input[name="delete-account"]').click(function(){
var countAccount = $('input:checkbox[name=deleteAccount]:checked').length; var countAccount = $('input:checkbox[name=deleteAccount]:checked').length;
if (countAccount == 0){
return false;
}else{
var answer = confirm( 'Are you sure you want to delete ' + ((countAccount > 1) ? 'these accounts' : 'this account') +'?'); var answer = confirm( 'Are you sure you want to delete ' + ((countAccount > 1) ? 'these accounts' : 'this account') +'?');
return answer; return answer;
}
}); });
}); });