-
Notifications
You must be signed in to change notification settings - Fork 64
/
index.html
237 lines (209 loc) · 8.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Forms 2.0 test page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="/css/core.css" />
<style>
label {width:100px;text-align:right;display:inline;}
input {height:20px;width:200px;}
[type=datetime] {font: normal 14px 'Helvetica Neue';color:red;}
[type=date] {font: bold 42px 'Hobo Std';}
[autofocus] {background:blue;}
[list] {background:#ff0;}
[required] {border:2px dotted green;}
input:required {outline: 2px solid #f00;color:red;}
div {margin-bottom:20px;overflow:hidden;}
form code {display:block;margin:10px 0 20px;}
section h1 {font-size:1.5em;}
input:out-of-range {border: 3px solid red;}
input:invalid {border:3px solid orange;}
</style>
<!-- Needed for Forms Feature Detection -->
<script type="text/javascript" src="../../shared/js/modernizr.com/Modernizr-2.5.3.forms.js">
</script>
<!-- Needed for Validation -->
<script type="text/javascript" src="../../shared/js/html5Forms.js" data-webforms2-support="all">
</script>
</head>
<body>
<header>
<h1>Web Forms 2.0 demo page</h1>
</header>
<section>
<h1>Notes:</h1>
<p>All tested on OSX 10.6.1. Obviously I've left out most of the standard, and therefore boring, inputs.
<p>Currently, this page is only interesting in Opera <span class="strike">9.60+ (earlier?)</span> 9.0+ (thanks <a href="http://twitter.com/FataL/status/6016610834">@FataL</a>), and partially-so in Safari 3+ / Chrome.
<p>Safari / Chrome: <code>autofocus</code> (4+), <code>type=search</code>, <code>placeholder</code>, <code>maxlength</code>, <code>:required</code> css pseudo-selector (4+), <code>type=range</code>—but can't hook into <code><output></code>.
<p>Opera: everything else, for the most part, except for <code>autofocus</code>, <code>placeholder</code>, a chrome style for <code>type=search</code>.
<p>Both Opera and Safari / Chrome have <code>type=color</code> implemented—but there is no fancy UI.
<p>Click submit, or hit enter to see validation errors in Opera. Client-side validation will only work for inputs that have a <code>name</code>:
<p><b>Bruce Lawson</b> <a href="http://twitter.com/brucel/status/4443537174">writes:</a> <q>forms with required attrib. need name attrib too, otherwise they don't take part in submission so can't be checked</q> (thanks!). See also his <a href="http://people.opera.com/brucel/demo/html5-forms-demo.html">html5 forms demo page.</a></p>
</section>
<section>
<h1>Demo:</h1>
<form action="http://www.useragentman.com/testForm.php">
<div>
<label>Text:
<input type="text" maxlength="6"/>
</label>
<code><input type="text" name="text" maxlength="6"/></code>
</div>
<div>
<label>Search:
<input type="search" name="search" list="search-suggestions" />
</label>
<datalist id="search-suggestions">
<option label="DM" value="Depeche Mode">
<option label="Moz" value="Morrissey">
<option label="NO" value="New Order">
<option label="TC" value="The Cure">
</datalist>
<code><pre>
(css) [list] {background:#ff0;}
<input type="search" autofocus list="search-suggestions"/>
<datalist id="search-suggestions">
<option label="DM" value="Depeche Mode">
<option label="Moz" value="Morrissey">
<option label="NO" value="New Order">
<option label="TC" value="The Cure">
</datalist>
</pre></code>
</div>
<div>
<label>Telephone:
<input type="tel" pattern="[0-9]{10}" name="tel" title="Phone Number?!?!"/>
</label>
<code><input type="tel" pattern="[0-9]{10}" name="tel" title="Phone Number?!?!"/></code>
</div>
<div>
<label>Password:
<input type="password" autofocus name="pass" placeholder="Password"/>
</label>
<code>
<pre>
(css) [autofocus] {background:blue;}
<input type="password" placeholder="Password"/>
</pre>
</code>
</div>
<div>
<label>URL:
<input type="url" id="url" name="earl" required />
</label>
<code>
<pre>
(css) [required] {border:2px dotted green;}
(css) input:required {outline: 2px solid #f00;color:red;}
<input type="url" id="url" name="earl" required />
</pre>
</code>
</div>
<div>
<label>Email:
<input type="email" placeholder="foo@bar.com" />
</label>
<code><input type="email" placeholder="foo@bar.com" /></code>
</div>
<div>
<label>Datetime:
<input type="datetime" />
</label>
<code><pre>
(css) [type=datetime] {font: normal 14px 'Helvetica Neue';color:red;}
<input type="datetime" />
</pre></code>
</div>
<div>
<label>Date:
<input type="date" />
</label>
<code><pre>
(css) [type=date] {font: normal 15px 'Hobo Std';}
<input type="date" />
</pre></code>
</div>
<div>
<label>Month:
<input type="month" />
</label>
<code><input type="month" /></code>
</div>
<label>Week:
<input type="week" />
</label>
<code><input type="week" /></code>
<div>
<label>Time:
<input type="time" />
</label>
<code><input type="time" /></code>
</div>
<label>Date-Time Local:
<input type="datetime-local" />
</label>
<code><input type="datetime-local" /></code>
<div>
<label>Number:
<input type="number" min="99" max="101"/>
</label>
<code><input type="number" min="99" max="101"/></code>
</div>
<div>
<label>Range:
<input type="range" name="range" />
<output required onforminput="value=range.value">0</output>
</label>
<pre>
<input type="range" required name="range" />
<output onforminput="value=range.value">0</output></pre>
</div>
<div>
<label>Color:
<input type="color" />
</label>
<code><input type="color"/></code>
</div>
<div>
<label>Checkbox:
<input type="checkbox" />
</label>
<code><input type="checkbox"/></code>
</div>
<div>
<label>Radio:
<input type="radio" />
</label>
<code><input type="radio"/></code>
</div>
<div>
<label>Select:
<select>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
<option>Option 4</option>
<option>Option 5</option>
<option>Option 6</option>
<option>Option 7</option>
<option>Option 8</option>
<option>Option 9</option>
<option>Option 10</option>
<option>Option 11</option>
</select>
</label>
</div>
<div>
<label>File:
<input type="file" multiple />
</label>
<code><input type="file" multiple /></code>
</div>
<input type="submit" />
</form>
</section>
<p class="small">Copyright © 2009 Michael Taylor and licensed under the <a href="/code/license.txt">MIT license.</a></p>
<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script>
<script type="text/javascript">try {var pageTracker = _gat._getTracker("UA-1911699-3");pageTracker._trackPageview();} catch(err) {}</script>
<body>
</html>