Topic: Passing Material Select values on submit

Carlton van Putten free asked 5 years ago


Expected behavior On submit of form I expect select values to be passed to POST endpoint

Actual behavior values are missing from the payload

Resources (screenshots, code snippets etc.) I have properly used the JQuery initialization script and form behaves correctly. However, when I click on submit, all select values are missing. I cannot find code examples to capture the values from the material-select UL and pass them to the endpoint.


MDBootstrap staff answered 5 years ago


Hi Carlton,

The data of material select is stored inside of the select that you build in HTML structure. After initialization with our jQ method, there is select-wrapper created and inside this wrapper, we create a structure to display our visual effect and we keep the select to contain the data you need in your form.

A simple example of getting the data from select

If you need additional help I am here for you.

Best Regards, Piotr


Carlton van Putten free commented 5 years ago

Your code doesnt update the html displayed? When I test your code it still doesn't pass values on submit


MDBootstrap staff commented 5 years ago

My code is just an example of how to get the data from the select. I predefined selected values and got the value from select after initialization. If you want to update the html you need to add event handler and use this method I presented.



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: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.10
  • Device: HP Spectre x360
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No