I have an iron-form
to do CRUD
in my project. This works well, apart of one problem.
How can I get the paper-dropdown-menu
to show the value from the model data ? (That is: preselect paper-item
corresponding to the [[o.id]] value from my model data)
The selected
attribute of paper-menu
does not help because it's index-based and not based on the value of a paper-item
.
Here is the code of the form:
<form is="iron-form" id="itemForm" method="post" action="/api/item/edit">
<input is="iron-input" name="id" type="hidden" value="{{item.id}}">
<paper-dropdown-menu label="Title" selected-item="{{selectedTitle}}">
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="{{titles}}" as="o">
<paper-item value="[[o.id]]">[[o.name]]</paper-item>
</template>
</paper-menu>
</paper-dropdown-menu>
<input is="iron-input" name="title" type="hidden" value$="[[selectedTitle.value]]">
<paper-input name="firstName" label="First name" value="{{item.firstName}}"></paper-input>
<paper-button raised onclick="document.getElementById('itemForm').submit()">Save</paper-button>
</form>