Hi, For anyone who is interested. After looking further into the Polymer code, it turns out to be a simple solution by modifying the 'paper-dropdown-menu.html' and add ' name="[[name]]" ' inside paper-input template to make it work. Otherwise, calling the req.body.name will never work I assume this is bug which should be fixed by Polymer team - just in my own opinion.
Roger [email protected]於 2016年12月19日星期一 UTC+8下午12時19分07秒寫道: > > Hi, > > I am using the 'paper-dropdown-menu' and return the selected menu item > value back to server by calling req.body.category. > > <paper-dropdown-menu name="category" label="Category" required> > <paper-menu attr-for-selected="value" class="dropdown-content"> > <paper-item value="Entertainment">Entertainment</paper-item> > <paper-item value="News">News</paper-item> > <paper-item value="Technology">Technology</paper-item> > <paper-item value="Others">Others</paper-item> > </paper-menu> > </paper-dropdown-menu> > > However, I am facing the below problem which the "selectedItemLabel'" does > return the correct selected value of <paper-item>, but getting the "value" > always return 'undefined' result. > > var s = document.querySelector('paper-dropdown-menu'); > console.log(s.selectedItemLabel); --> OUTPUT 'News' if I select News > console.log(s.value); --> OUTPUT 'undefined' > > Further reading the 'value' property from polymer document, it does > mentioned that 'label' is a read only String type and "will always have the > same value as "selectedItemLabel", which is not TRUE for my case as proven > above. Is this a bug or something I did wrong inside my code. Thanks. > > Statement for "value" from Polymer paper-dropdown-menu document: > The value for this element that will be used when submitting in a form. It > is read only, and will always have the same value as selectedItemLabel. > > Roger > Follow Polymer on Google+: plus.google.com/107187849809354688692 --- You received this message because you are subscribed to the Google Groups "Polymer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/356cf616-3311-4ab4-8ae1-4bffc697c842%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
