OnSubmit无法正常工作

时间:2018-02-26 17:21:55

标签: reactjs react-bootstrap

我有渲染函数返回以下组件:

<form onSubmit={(e) => this.filter(e)}>
            <Modal className='side-modal' show={this.props.show} onHide={this.props.hide}>
                <Scrollbars autoHide>
                    <Modal.Header closeButton>
                        <Modal.Title>Filter</Modal.Title>
                    </Modal.Header>
                    <Modal.Body>
                        <FormGroup>
                            <ControlLabel>Search Based On Keywords</ControlLabel>
                            <FormControl value={this.state.searchInput} type='text' placeholder='Legal Entity Name, DBA Name, Email or Processor Submerchant ID' onChange={this.setInputSearchText} />
                        </FormGroup>
                        <FormGroup>
                            <ControlLabel>Account Status</ControlLabel>
                            <CustomSelect
                                selectID={'accountStatus'}
                                hasListIcon={true}
                                listItemDetails={this.state.itemList}
                                defaultItemObj={this.state.defaultItem}
                                isReset={this.state.isReset}
                                setValue={this.setAccountStatusValue}
                            />
                        </FormGroup>
                    </Modal.Body>
                </Scrollbars>
                <Modal.Footer>
                    <Button bsStyle='primary' type='submit'>
                        <span className='icon ion-checkmark icon--inner'></span> Apply
        </Button>
                    <Button type='reset' onClick={this.resetFilter}>
                        <span className='icon ion-android-refresh icon--inner'></span> Reset
        </Button>
                </Modal.Footer>
            </Modal>
        </form>

我希望表单在点击&#39;输入&#39;时调用过滤器功能。来自键盘,但它似乎不起作用,即使在点击应用时也不会调用提交。这可能是什么问题?先感谢您。 这是我的过滤功能:

filter = (e: any) => {
    e.preventDefault();
    this.getSomeReults();
    this.props.hide();
}

0 个答案:

没有答案