feat: clear inputs onSubmit
This commit is contained in:
parent
714fd6357e
commit
87fce3c636
@ -30,6 +30,11 @@ class CreateNodule extends Component {
|
||||
document.addEventListener('updateTables', this.updateTableList)
|
||||
}
|
||||
|
||||
clearInput = () => {
|
||||
this.setState({ noduleType: '' })
|
||||
this.tableSelect.current.clearTablesSelected()
|
||||
}
|
||||
|
||||
handleChange = (e, value) => {
|
||||
this.setState({ noduleType: value.value })
|
||||
}
|
||||
@ -65,6 +70,8 @@ class CreateNodule extends Component {
|
||||
structure: structureProperties
|
||||
})
|
||||
}
|
||||
|
||||
this.clearInput()
|
||||
}
|
||||
|
||||
updateTableList = () => {
|
||||
@ -94,6 +101,7 @@ class CreateNodule extends Component {
|
||||
<br />
|
||||
|
||||
<Dropdown
|
||||
value ={this.state.noduleType}
|
||||
placeholder='Select a Nodule Type'
|
||||
options={[
|
||||
{key: 'Join Nodule', text: 'Join Nodule', value: 'join', icon: 'sitemap'},
|
||||
|
@ -15,6 +15,10 @@ class TableSelect extends Component {
|
||||
document.addEventListener('updateTables', this.updateTableList)
|
||||
}
|
||||
|
||||
clearTablesSelected = () => {
|
||||
this.setState({ selectedTablesLabels: [] })
|
||||
}
|
||||
|
||||
getSelectedTableLabels = () => this.state.selectedTablesLabels
|
||||
|
||||
toggleSelect = label => {
|
||||
|
@ -12,12 +12,24 @@ class CreateTableForm extends Component {
|
||||
this.tableFileInput = React.createRef()
|
||||
}
|
||||
|
||||
// handleLabelChange = (e, value) => {
|
||||
// e.preventDefault()
|
||||
// this.setState({ label: value })
|
||||
// }
|
||||
|
||||
// handleFileChange = (e, value) => {
|
||||
// e.preventDefault()
|
||||
// this.setState({ file: value })
|
||||
// }
|
||||
|
||||
handleSubmit = async e => {
|
||||
e.preventDefault()
|
||||
const label = this.tableLabelInput.current.inputRef.current.value
|
||||
const file = this.tableFileInput.current.inputRef.current.files[0]
|
||||
|
||||
this.controller.submitLocalFile({ label, file })
|
||||
|
||||
this.tableLabelInput.current.inputRef.current.value = ''
|
||||
}
|
||||
|
||||
render = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user