Reputation: 720
I have just started exploring polymer.js. I want to get input from paper-input element. And want to read it. I have a paper button. On clicking that button, value in paper-input should be stored in global variable USER_NAME.
I referred the stackoverflow post Polymer: get the value of paper-input inside a paper-dialog after paper-button press "ok"
But it is not working for me. Here is my code:
<div id="profileInfoForm">
<h2>Tell us about you...</h2>
<div class="profileField">
<h5>Name :</h5>
<paper-input name="profileName" id="profileNameId" inputValue="{{ valHeader }}" label="What will we call you ?"></paper-input>
</div>
<div class="profileField" style="text-align: center;">
<div onclick="fetchDataFromForm();" id="proceedButton" class="button raised blue" style="text-align: center">
<div class="center" fit>Proceed</div>
<paper-ripple fit></paper-ripple>
</div>
</div>
</div>
<script>
var USER_NAME="";
Polymer('note-list',{
fetchDataFromForm: function(e, detail, sender)
{
USER_NAME = this.valHeader;
}
});
</script>
Thanks.
Upvotes: 1
Views: 1598
Reputation: 3980
The example you copied from was not complete. The script at the bottom is defining an element called note-list
, but they omitted the part where they began the element's definition. See this jsbin for a working version of your code.
Two takeaways:
Polymer('note-list', ...
is only useful if you also create a polymer-element
definition.on-[event]
syntax (notice the dash) and use handlebars {{ }}
around the handler name in the attribute value.Upvotes: 3