Blame view

bower_components/iron-form/demo/index.html 4.56 KB
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">
c5169e0e   Renato De Donato   a new hope
22
    <link rel="import" href="../../paper-styles/paper-styles.html">
73bcce88   luigser   COMPONENTS
23
    <link rel="import" href="../../paper-styles/demo-pages.html">
e619a3b0   Luigi Serra   Controllet cross ...
24
    <link rel="import" href="../../paper-checkbox/paper-checkbox.html">
73bcce88   luigser   COMPONENTS
25
    <link rel="import" href="../iron-form.html">
e619a3b0   Luigi Serra   Controllet cross ...
26
    <link rel="import" href="simple-element.html">
73bcce88   luigser   COMPONENTS
27
28
29
30
31
32
33
  </head>
  <style>
    .wide {
      width: 474px;
    }
  </style>
  <body>
c5169e0e   Renato De Donato   a new hope
34
    <div class="horizontal center-center layout">
73bcce88   luigser   COMPONENTS
35
36
37
38
39
40
41
42
43
44
      <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 ...
45
            <paper-checkbox name="food" value="cheese" required>I like cheese</paper-checkbox><br>
73bcce88   luigser   COMPONENTS
46
  
e619a3b0   Luigi Serra   Controllet cross ...
47
48
49
50
51
52
53
54
55
            <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
56
57
58
59
  
            <br><br>
  
            <paper-button raised
c5169e0e   Renato De Donato   a new hope
60
                onclick="clickHandler(event)">Submit</paper-button>
73bcce88   luigser   COMPONENTS
61
62
63
64
65
66
67
68
69
70
71
          </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 ...
72
73
74
75
76
  
            <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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  
            <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
c5169e0e   Renato De Donato   a new hope
103
                onclick="clickHandler(event)">Submit</paper-button>
73bcce88   luigser   COMPONENTS
104
            <button type="submit">Native Submit</button>
73bcce88   luigser   COMPONENTS
105
106
107
108
          </form>
        </div>
      </div>
    </div>
c5169e0e   Renato De Donato   a new hope
109
  
73bcce88   luigser   COMPONENTS
110
    <br><br>
c5169e0e   Renato De Donato   a new hope
111
    <div class="layout vertical center-center">
73bcce88   luigser   COMPONENTS
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
      <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);
      }
  
c5169e0e   Renato De Donato   a new hope
129
      function clickHandler(event) {
73bcce88   luigser   COMPONENTS
130
131
        Polymer.dom(event).localTarget.parentElement.submit();
      }
73bcce88   luigser   COMPONENTS
132
133
134
135
    </script>
  </body>
  
  </html>