Topic: Get value of search field in MDBSelect component

fbrunetti premium asked 4 years ago


Hello,

I am trying to figure out how I can get the value of the search field from an MDBSelect component with the search prop set to true. E.g.

<MDBSelect
    getValue={this.handleChange}
    id={name}
    name={name}
    options={options}
    placeholder={placeholder}
    search
    selected={placeholder}
/>

I know I can use the getValue method to retrieve the currently selected option, but how can I access the search string when the user types into the search field?


Jakub Chmura staff answered 4 years ago


Hi @fbrunetti,

You can't do this by props or build function because we don't have any function that returns the value of the search field in the select component.

You can try to write your own logic to get the value of the select field but I don't know if it will work correctly.

Best, Kuba


Nalini@111 free commented 1 year ago

Hello, I also would like to know how to get the value of search field in MDBSelect component. Do you guys have solution of it after 2 years now?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: 4.21.1
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: Yes
  • Provided link: No