1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

When it is empty, submit btn is disabled

This commit is contained in:
zxj96
2019-05-17 11:09:05 +08:00
parent 398c9f3f96
commit d70051f087
8 changed files with 66 additions and 21 deletions

View File

@@ -10,10 +10,17 @@ class RenameGroupDialog extends React.Component {
super(props);
this.state = {
newGroupName: this.props.currentGroupName,
isSubmitBtnActive: false,
};
}
handleGroupNameChange = (event) => {
if (!event.target.value.trim()) {
this.setState({isSubmitBtnActive: false});
} else {
this.setState({isSubmitBtnActive: true});
}
let name = event.target.value;
this.setState({
newGroupName: name
@@ -52,7 +59,7 @@ class RenameGroupDialog extends React.Component {
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.props.toggleRenameGroupDialog}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.renameGroup}>{gettext('Submit')}</Button>
<Button color="primary" onClick={this.renameGroup} disabled={!this.state.isSubmitBtnActive}>{gettext('Submit')}</Button>
</ModalFooter>
</Modal>
);