Reputation: 1825
how to get value of Material-ui auto-complete in react.js.
I tired
productName: this.refs.productName.value
productName: this.refs.productName.getValue()
both are not working
<AutoComplete
hintText="Product Name"
// filter={AutoComplete.noFilter}
// filter={AutoComplete.fuzzyFilter}
filter={AutoComplete.caseInsensitiveFilter}
openOnFocus={true}
name="productName"
ref="productName"
value={this.props.signUpState.productName}
dataSource={datasource}
floatingLabelText="Product Name"
hintText="Product Name"
onChange={this.props._inputHandler}
// onUpdateInput={this.props.signUpState.handleUpdateInput}
// dataSourceConfig={dataSourceConfig}
/>
Upvotes: 2
Views: 7290
Reputation: 17
this.refs.productName.state.searchText
alternative,
use onUpdateInput prop.
<Autocomplete
onUpdateInput={this.handleUpdateInput.bind(this)}
/>
handleUpdateInput = (searchText) => {
console.log(searchText)
}
Upvotes: 1