如何提交带有聚合物的表格? [英] How to submit a form with polymer?
本文介绍了如何提交带有聚合物的表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个聚合物接触元件:
I've have this polymer contact-element:
<polymer-element name="contact-element">
<template>
<paper-input label="Your Name" id="contact-name" floatingLabel></paper-input>
<paper-input multiline label="Your text here..." id="contact-message" floatingLabel></paper-input>
<paper-button label="Send Data" id="contact-submit" raisedButton></paper-button>
</template>
<script>
Polymer({});
</script>
</polymer-element>
它包含在这个 index.html 中
It's included in this index.html
<form action="/sendMessage" method="GET">
<contact-element></contact-element>
</form>
paper-button 是否有提交属性,或者我必须用 JS 提交?
Is there an submit-attribute for the paper-button or do I have to do the submit with JS?
推荐答案
对于任何未来的读者,现在 1.0 已发布:
For any future Readers, now that 1.0 is released:
这是基本的html表单处理.在撰写本文时,Polymer 现在拥有 iron-form,但是您仍然像任何其他表单一样提交它.
This is basic html form processing. At the time of this writing, Polymer now has the iron-form, but you still submit it like any other form.
<form is="iron-form" id="form" method="post" action="/">
<paper-input name="testinput"></paper-input>
<paper-button raised click="document.getElementById('form').submit();">
Post
</paper-button>
</form>
这篇关于如何提交带有聚合物的表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文