1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-10 11:21:29 +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

@@ -19,12 +19,19 @@ class CreateRepoDialog extends React.Component {
password1: '',
password2: '',
errMessage: '',
permission: 'rw'
permission: 'rw',
isSubmitBtnActive: false,
};
this.newInput = React.createRef();
}
handleRepoNameChange = (e) => {
if (!e.target.value.trim()) {
this.setState({isSubmitBtnActive: false});
} else {
this.setState({isSubmitBtnActive: true});
}
this.setState({repoName: e.target.value});
}
@@ -205,7 +212,7 @@ class CreateRepoDialog extends React.Component {
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
<Button color="primary" onClick={this.handleSubmit} disabled={!this.state.isSubmitBtnActive}>{gettext('Submit')}</Button>
</ModalFooter>
</Modal>
);