73bcce88
luigser
COMPONENTS
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-form demo</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
73bcce88
luigser
COMPONENTS
|
20
21
|
<link rel="import" href="../../paper-input/paper-input.html">
<link rel="import" href="../../paper-button/paper-button.html">
|
73bcce88
luigser
COMPONENTS
|
22
|
<link rel="import" href="../../paper-styles/demo-pages.html">
|
e619a3b0
Luigi Serra
Controllet cross ...
|
23
|
<link rel="import" href="../../paper-checkbox/paper-checkbox.html">
|
a1a3bc73
Luigi Serra
graphs updates
|
24
25
26
|
<link rel="import" href="../../paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../../paper-menu/paper-menu.html">
<link rel="import" href="../../paper-item/paper-item.html">
|
73bcce88
luigser
COMPONENTS
|
27
|
<link rel="import" href="../iron-form.html">
|
e619a3b0
Luigi Serra
Controllet cross ...
|
28
|
<link rel="import" href="simple-element.html">
|
73bcce88
luigser
COMPONENTS
|
29
30
31
32
33
34
35
|
</head>
<style>
.wide {
width: 474px;
}
</style>
<body>
|
a1a3bc73
Luigi Serra
graphs updates
|
36
|
<div class="horizontal-section-container">
|
73bcce88
luigser
COMPONENTS
|
37
38
39
40
41
42
43
44
45
46
|
<div>
<h4>method="get"</h4>
<div class="horizontal-section">
<form is="iron-form" id="formGet" method="get" action="/">
<paper-input name="name" label="Name" required></paper-input>
<paper-input name="animal" label="Favourite animal" required></paper-input>
<br>
<input type="checkbox" name="food" value="donuts" checked> I like donuts<br>
<input type="checkbox" name="food" value="pizza" required> I like pizza<br>
|
e619a3b0
Luigi Serra
Controllet cross ...
|
47
|
<paper-checkbox name="food" value="cheese" required>I like cheese</paper-checkbox><br>
|
73bcce88
luigser
COMPONENTS
|
48
|
|
a1a3bc73
Luigi Serra
graphs updates
|
49
50
51
52
53
54
55
56
57
|
<paper-dropdown-menu label="Cars" name="cars" required>
<paper-menu class="dropdown-content">
<paper-item>Volvo</paper-item>
<paper-item>Saab</paper-item>
<paper-item>Fiat</paper-item>
<paper-item>Audi</paper-item>
</paper-menu>
</paper-dropdown-menu>
|
e619a3b0
Luigi Serra
Controllet cross ...
|
58
59
60
61
62
63
64
65
66
|
<p>
Sample custom element, not required: <br>
<simple-element name="custom-one"></simple-element>
</p>
<p>
Sample custom element, required: (look, styling!)<br>
<simple-element required name="custom-two"></simple-element><br>
</p>
|
73bcce88
luigser
COMPONENTS
|
67
68
69
70
|
<br><br>
<paper-button raised
|
a1a3bc73
Luigi Serra
graphs updates
|
71
72
73
|
onclick="submitHandler(event)">Submit</paper-button>
<paper-button raised
onclick="resetHandler(event)">Reset</paper-button>
|
73bcce88
luigser
COMPONENTS
|
74
75
76
77
78
79
80
81
82
83
84
|
</form>
</div>
</div>
<div>
<h4>method="post"</h4>
<div class="horizontal-section">
<form is="iron-form" id="formPost" method="post" action="/">
<paper-input name="name" label="Name" required></paper-input>
<br>
<p>Duplicate name <input name="name" required></p>
|
e619a3b0
Luigi Serra
Controllet cross ...
|
85
86
87
88
89
|
<input type="radio" name="color" value="red" checked>Red<br>
<input type="radio" name="color" value="blue" checked>Blue<br>
<input type="radio" name="color" value="green">Green<br>
<br>
|
73bcce88
luigser
COMPONENTS
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<label>Cars</label>
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<br><br>
<label>Browsers</label>
<input list="browsers" name="browsers" required>
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
<br><br>
<label>Pick a number</label>
<input type="range" name="number" min="1" max="100">
<br><br><br>
<paper-button raised
|
a1a3bc73
Luigi Serra
graphs updates
|
116
|
onclick="submitHandler(event)">Submit</paper-button>
|
73bcce88
luigser
COMPONENTS
|
117
|
<button type="submit">Native Submit</button>
|
a1a3bc73
Luigi Serra
graphs updates
|
118
|
<button type="reset">Native Reset</button>
|
73bcce88
luigser
COMPONENTS
|
119
120
121
122
|
</form>
</div>
</div>
</div>
|
73bcce88
luigser
COMPONENTS
|
123
|
<br><br>
|
a1a3bc73
Luigi Serra
graphs updates
|
124
|
<div class="horizontal-section-container">
|
73bcce88
luigser
COMPONENTS
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
<div>
<h4>Submitted form data</h4>
<div class="horizontal-section wide">
<div id="output"></div>
</div>
</div>
</div>
<script>
document.getElementById('formGet').addEventListener('iron-form-submit', display);
document.getElementById('formPost').addEventListener('iron-form-submit', display);
function display(event) {
var output = document.getElementById('output');
output.innerHTML = JSON.stringify(event.detail);
}
|
a1a3bc73
Luigi Serra
graphs updates
|
142
|
function submitHandler(event) {
|
73bcce88
luigser
COMPONENTS
|
143
144
|
Polymer.dom(event).localTarget.parentElement.submit();
}
|
a1a3bc73
Luigi Serra
graphs updates
|
145
146
147
|
function resetHandler(event) {
Polymer.dom(event).localTarget.parentElement.reset();
}
|
73bcce88
luigser
COMPONENTS
|
148
149
150
151
|
</script>
</body>
</html>
|