Topic: Use the User's input in MDBSelect Search
Expected behavior
I'd like to use an MDBSelect search in a create/update form.
- Update case:
The user will fill the
ID
in the select, choose one of the options, and then all the form will be filled up. The user will make all the changes he needs to do and save them. This case is working well. - Create case:
The user will fill the
ID
in the select, there will be no record to this ID. So the user will press enter or tab and continues to fill the form. After that, he will save them and a new item is created. This case is not working.
ACTUAL behavior
- Create case: I can't get the user's input. The API just have
getValue
andgetTextContent
methods, which are made to get one of the options listed, not the user's input.
Actually, I'm not sure if I can do this with this component. Could anyone help me with this?
Thank you,
Caio Davi
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Closed
Specification of the issue
- User: Free
- Premium support: No
- Technology: MDB React
- MDB Version: 4.26.0
- Device: PC
- Browser: Any
- OS: Debian
- Provided sample code: No
- Provided link: Yes
Tags
Related topics
Jakub Chmura staff premium commented 4 years ago
Hi @caio.davi,
Please tell me if I understand your problem correctly.
You need to get access to input search
current.value
to get content and use this content to check if you need to create or update form?If yes, this is not possible. The select search input is filtering over existing options and it's not possible to do what you describe when filtered list is empty. If you want to create an option you will need to create an external form for that.
Best, Kuba
caio.davi commented 4 years ago
Thank you @Jakub Chmura,
I figured out that it would be impossible using MDBSelect. I chose to create my own component for this case (A kind of
search-selector
which also works asinput
somehow). Until the moment it is working well. I had some trouble with the style (to make it seems like the other components from MDB React), but I think I'm close enough.Jakub Chmura staff premium commented 4 years ago
Nice to hear that you solve your problem.
If there is anything else I could do for you do not hesitate to ask me. I'll be happy to help you.
Best, Kuba