CreativeIT / getmdl-select

Select for material-design-lite
http://creativeit.github.io/getmdl-select/
MIT License
301 stars 87 forks source link

Value submitted is 'value' of text-input, not data-val #64

Closed mattholtom closed 7 years ago

mattholtom commented 7 years ago

When I submit a form containing your plugin example, the value sent to the server is 'Russia', not 'RU'.

Is this intended behaviour or am I misusing the plugin? Do I need to modify the form-submit using javascript or is normal HTTP form submission possible with this plugin.

My use case is Month selection

{January} {February} etc.

But the value I want submitted to the server is 1, or 2

Thanks for your work,

alexbananabob commented 7 years ago

Hello, Mattholtom Thank you for your question. As you can see in markup in Readme file getmdl-select is a simple <input/> which works in conjunction with .mdl-menu. So with submitting form to server sends only input.value, not data-val. It is intended behaviour.

So for your task you need to read data-val attr and modify the form-submit using javascript

Good luck