• Home
Name Date Size #Lines LOC

..--

.github/03-May-2024-3414

demo/03-May-2024-317271

test/03-May-2024-947817

.bower.jsonD03-May-20242.8 KiB7878

.gitignoreD03-May-202431 32

.travis.ymlD03-May-20241.8 KiB2726

CONTRIBUTING.mdD03-May-20243.4 KiB7839

README.mdD03-May-20241.6 KiB5328

bower.jsonD03-May-20242.6 KiB7069

index.htmlD03-May-2024987 3114

iron-form.htmlD03-May-202416.1 KiB463336

README.md

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[![Build status](https://travis-ci.org/PolymerElements/iron-form.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-form)
16
17_[Demo and API docs](https://elements.polymer-project.org/elements/iron-form)_
18
19
20## &lt;iron-form&gt;
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