1 2<!--- 3 4This README is automatically generated from the comments in these files: 5iron-form.html 6 7Edit those files, and our readme bot will duplicate them over here! 8Edit this file, and the bot will squash your changes :) 9 10The bot does some handling of markdown. Please file a bug if it does the wrong 11thing! https://github.com/PolymerLabs/tedium/issues 12 13--> 14 15[](https://travis-ci.org/PolymerElements/iron-form) 16 17_[Demo and API docs](https://elements.polymer-project.org/elements/iron-form)_ 18 19 20## <iron-form> 21`<iron-form>` is a wrapper around the HTML `<form>` element, that can 22validate and submit both custom and native HTML elements. 23 24It has two modes: if `allow-redirect` is true, then after the form submission you 25will be redirected to the server response. Otherwise, if it is false, it will 26use an `iron-ajax` element to submit the form contents to the server. 27 28 Example: 29 30```html 31 <iron-form> 32 <form method="get" action="/form/handler"> 33 <input type="text" name="name" value="Batman"> 34 <input type="checkbox" name="donuts" checked> I like donuts<br> 35 <paper-checkbox name="cheese" value="yes" checked></paper-checkbox> 36 </form> 37 </iron-form> 38``` 39 40By default, a native `<button>` element (or `input type="submit"`) will submit this form. However, if you 41want to submit it from a custom element's click handler, you need to explicitly 42call the `iron-form`'s `submit` method. 43 44 Example: 45 46```html 47 <paper-button raised onclick="submitForm()">Submit</paper-button> 48 49 function submitForm() { 50 document.getElementById('iron-form').submit(); 51 } 52``` 53