CreativeIT / getmdl-select

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

stopped working in latest release #71

Closed davidtelfer closed 6 years ago

davidtelfer commented 6 years ago

using the samples on your website, and my existing code, this has all stopped working. the selected value is now placed in the "value" attribute on the hidden input field, and is no longer placed in the "data-val" attribute on the readonly text input field. this breaks all existing functionality, inlcuding your own samples.

nunomelof commented 6 years ago

Same problem identified, someone knows how to fix it?

alexbananabob commented 6 years ago

@davidtelfer, @nunomelof, did it happen after you update getmdl-select from 1.1.0 to 2.0.0?

davidtelfer commented 6 years ago

Hi Alex,

I had been referencing the code (script and css) from https://cdn.rawgit.com/CreativeIT/getmdl-select/master/ which had been v1.1.0.

Our site was noticed to be broken yesterday (2nd Jan 2017). When I looked into it, it initially seemed to be that the path (above) was no longer available at all (404 errors), so I checked out your website, got the latest code (v2.0) altered my page to use the new “hidden” control etc., but could not make anything work when updating to my database via JS.

I then looked into the samples, on your site, and using the “inspect” facility in chrome, I saw that the “hidden” input field’s “value” attribute was being set by the new version 2.0 code, where my JS was still grabbing the “data-val” attribute from the original “readonly” input field. My concern was that the documentation still refers to getting the value from “data-val” (which does not currently work in v2.0) and that if I re-coded my javascript to work with the “hidden” input field’s “value” attribute, then it could all break again if the “bug” gets fixed (as opposed to the documentation being changed to reflect what actually happens in which case all could remain working). I have therefore reverted to a local copy of v1.0.0 (instead of the cdn) and all is well for me. Clearly upgrading to v2.0.0 requires more work to the page and my JS, and it seems as though the cdn above got upgraded automatically (it was not versioned within the path like some are) without warning 5 days ago.

Many apologies If I was doing anything wrong (referencing the wrong cdn etc?) I am a bit of a web noob and MDL noob, but have been coding for 40 years on desktop stuff.

I hope this helps, but happy to explain more if theres anything else you need to know.

Thanks Dave

nunomelof commented 6 years ago

Hi David and Alex

I also used the same link to include the library in my code and I see that it is a wrong way to do it since it is linked to the master branch of the github, so if you commit a new update it will automatically change and it could happen that our code could not be prepared for the new changes.

As suggestion the code could be available in cdn with the version in the link, like getmdl-select-1-1-0.min.js ;)

@davidtelfer thank you for your suggestion it actually worked and I was able to restore the functionalities in the web pages. For further notice if people want to know how to get version 1.1.0 go to this version https://github.com/CreativeIT/getmdl-select/tree/7d8dd6e1696ecab793b753bbe68bfe7943e5bb63 and download the getmdl-select.min.js file and fix the links in your html code to the static js file.

Thank you both for your fast and constructive replies which helped me a lot ;)

alexbananabob commented 6 years ago

As @nunomelof wrote is bad practice to create cdn.rawgit links from master branch without fork repository. As suggestion you can create cdn.rawgit links from last release 1.1.0 (https://github.com/CreativeIT/getmdl-select/tree/1.1.0) Thanks @nunomelof.

alexbananabob commented 6 years ago

@davidtelfer, we really had a mistake about data-val in README file. Now it's fixed.

Thanks @davidtelfer for your attentiveness