The value of the precipitated polymer core

I am using a core-dropdown box in my form along with other core and paper elements. I can get the values ​​for all inputs, but I cannot get the value of the dropdown field on the submit form. According to the documentation, there is a property selectedItem

that can be used to get the selected value, but there are no instructions on how to use it.

On a separate note, although I can post resin paper input fields using this solution , but if there is another elegant solution for handling a resin form, preferably any type of field, like text, radio, checkbox, select, file, etc. then please share.

+3


source to share


1 answer


The polymer API is changing rapidly, but currently the way to work with dropdowns and selections is <core-selector>

element .

So, inside yours core-dropdown

, you will have something like this:

<core-selector selected="{{selectedIndex}}">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</core-selector>

      

You can bind to an attribute selected

that represents either the index of the selected element or a specific attribute value, if used valueattr

.



Polymer('selector-example', {
    ready: function () {
        this.selectedIndex = 2; // 'Item 3' will be selected
    }
});

      

Unfortunately I cannot expand my solution as the link is broken.

Hope it helps.

0


source







All Articles