Topic: Mdb select do not chnagde related input value and name. How can I send selected data to backend???
bogdan_dubyk free asked 4 years ago
*_Expected behavior_*When I select an option from select, related (hidden) input value should be set to the value of a selected option, also when I set a name for related input name should be set. So I can easily send data to backend
*_Actual behavior_*Value and name of related input always empty
Mateusz Łubianka staff answered 4 years ago
Hi @bogdan_dubyk,
I created a snippet with example how to get value from select:
https://mdbootstrap.com/snippets/jquery/mateusz-lubianka/1986052
Best,
bogdan_dubyk free commented 4 years ago
Yeah, it can work, thank you! But why it's not supported out of the box without such workarounds??
What if I want to quickly make a form and send it to the backend in a good old way (without ajax and additional js code)?
For me, it seems that such functionality should be already implemented out of the box (as far as I know other libraries implementing it )... Select has an underlying input tag, so the value should be set to that fields automatically when the user picks some option. And same is with a name, when I set the name for a select it should be proxy to underlying input tag
Mateusz Łubianka staff commented 4 years ago
Do you mean gaining a slect value other than $('#selectID').val();?
Best,
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.8.9
- Device: MacBook
- Browser: FireFox
- OS: MacOs
- Provided sample code: No
- Provided link: No