disable submit button while groupname is empty

This commit is contained in:
Robin Appelman 2015-03-18 14:17:20 +01:00
parent 093efa458c
commit cb4367b6d5
1 changed files with 13 additions and 0 deletions

View File

@ -182,6 +182,7 @@ GroupList = {
$('#newgroup-form').show();
$('#newgroup-init').hide();
$('#newgroupname').focus();
GroupList.handleAddGroupInput('');
}
else {
$('#newgroup-form').hide();
@ -190,6 +191,14 @@ GroupList = {
}
},
handleAddGroupInput: function (input) {
if(input.length) {
$('#newgroup-form input[type="submit"]').attr('disabled', null);
} else {
$('#newgroup-form input[type="submit"]').attr('disabled', 'disabled');
}
},
isGroupNameValid: function (groupname) {
if ($.trim(groupname) === '') {
OC.dialogs.alert(
@ -295,4 +304,8 @@ $(document).ready( function () {
$userGroupList.on('click', '.isgroup', function () {
GroupList.showGroup(GroupList.getElementGID(this));
});
$('#newgroupname').on('input', function(){
GroupList.handleAddGroupInput(this.value);
});
});