I have an error, I am replicating the error in jsbin: https://jsbin.com/micinalacu/1/edit?html,console,output
The iron form, when you send the serialize method, always returns undefined, and it calls twice.
<dom-module id="my-form"> <template> <iron-form id="myForm"> <form method="get" action="cenfdsas"> <input type="text" name="cenas"> <button on-click="cenas">Submit</button> </form> </iron-form> </template> <script> class MyForm extends Polymer.Element { static get is() { return 'my-form'; } connectedCallback() { super.connectedCallback(); const form = this.$.myForm; form.addEventListener('iron-form-presubmit', function (event) { event.preventDefault(); console.log("here") console.log(form.serialize()); }); } cenas() { this.$.myForm.submit(); } } window.customElements.define(MyForm.is, MyForm); </script> </dom-module>
Update
The polymer team had to change the method name for serializeForm because they had an error. Source: https://github.com/PolymerElements/iron-form/issues/174
But I continue with the problem that the dispatch event that he called twice Error → https://jsbin.com/koyelafeze/1/edit?html,console,output
source share