Javascript 聚合铁表格,输入时提交两次

Javascript 聚合铁表格,输入时提交两次,javascript,html,debugging,polymer,Javascript,Html,Debugging,Polymer,处理Polymer中的注释元素,用户按enter键时应提交注释。“输入”部分工作正常,但注释提交两次,导致重复。你能告诉我出了什么问题吗?谢谢 <link rel="import" href="/bower_components/polymer/polymer.html"> <link rel="import" href="/bower_components/paper-input/paper-input.html"> <link rel="import" href

处理Polymer中的注释元素,用户按enter键时应提交注释。“输入”部分工作正常,但注释提交两次,导致重复。你能告诉我出了什么问题吗?谢谢

<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/paper-input/paper-input.html">
<link rel="import" href="/bower_components/iron-form/iron-form.html">
<link rel="import" href="/bower_components/iron-input/iron-input.html">
<link rel="import" href="/bower_components/iron-a11y-keys/iron-a11y-keys.html">
<dom-module is="post-comments">
    <template>

        <div class="wrapper">
            <div class="comment-input-wrapper">

                <iron-a11y-keys id="a11y" keys="enter" target="[[target]]"
                                on-keys-pressed="sendComment" stopKeyboardEventPropagation="true"></iron-a11y-keys>

            <form is="iron-form" method="get" action="/ajax/group/comment.php" id="commentForm">
                <input is="iron-input" type="text" name="comment" placeholder="Kommenter..." value="{{commentInput::input}}" class="comment_input" id="currentComment">
                <input type="hidden" name="post_id" value="{{postId}}">
            </form>
            </div>
        </div>
    </template>
    <script>
        Polymer({
            is: "post-comments",
            properties: {
                postId: {
                    type: Number
                },
                commentInput: {
                    type: String,
                    notify: true
                },
                target: {
                    type: Object,
                    value: function() {
                        return this.$.currentComment;
                    }
                }
            },
            listeners: {
                'iron-form-response': 'displayMessage'
            },
            sendComment: function(e) {
                    this.$.commentForm.submit();

            },
            displayMessage: function(e) {
                //Display response

            }
        });
    </script>
</dom-module>

聚合物({
是:“发表评论”,
特性:{
职位:{
类型:编号
},
评论输入:{
类型:字符串,
通知:正确
},
目标:{
类型:对象,
值:函数(){
返回此。$.currentComment;
}
}
},
听众:{
“iron表单响应”:“displayMessage”
},
sendComment:函数(e){
此.commentForm.submit();
},
显示消息:函数(e){
//显示响应
}
});

通过向sendComment函数添加setInterval解决了这个问题