-
Notifications
You must be signed in to change notification settings - Fork 15
/
form-cc-example.html
148 lines (144 loc) · 6.4 KB
/
form-cc-example.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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Ido Green | greenido.wordpress.com | @greenido">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#db5945">
<title>Auto Complete Attribute Example</title>
<style type="text/css">
input, textarea {
padding-top: 0.5em;
padding-bottom: 0.5em;
width: 100%;
border: 1px solid gray;
}
p {
background: rgba(244, 187, 110, 0.47);
padding: 0.7em;
border-radius: 1em;
}
form {
width: 100%;
}
input.dirty:not(:focus):invalid {
background-color: #FFD9D9;
}
input.dirty:not(:focus):valid {
background-color: #D9FFD9;
}
fieldset {
background: rgba(199, 183, 171, 0.61);
margin-top: 2.5em;
border-radius: 1em;
}
legend {
font-size: 120%;
padding-right: 0.5em;
padding-left: 0.5em;
}
#butCheckout {
padding: 1.5em;
border-radius: 0.2em;
}
</style>
<body>
<h1>AutoComplete Example</h1>
<p>
To try this example, open it in Chrome (version 42+) and try to start filling the fields. Chrome will suggest you 'auto fill' data from what it got so far.
<br></p>
<h3>Wallet Integration</h3>
<p>
If you got
<a href="http://google.com/wallet">Google Wallet</a>
with you credit card data, even better! Go to the
<a href="#paymentSec">'Payment' section</a>
and start to fill the data. Chrome will offer you to pre-fill it with the current credit card's information wallet got on file.
<br>
(!) The current spec can be found at:
<a href="https://html.spec.whatwg.org/multipage/forms.html#association-of-controls-and-forms">html.spec.whatwg.org/multipage/forms.html</a>
</p>
<h3>Material Design</h3>
<p>
You can see one way to leverage the power of material design with these forms in this
<a href="form-cc-example-m2.html">Material design example</a>
</p>
<div role="main">
<form method="post" id="usrForm">
<fieldset>
<legend>Contact Info</legend>
<label for="frmNameA">Name</label>
<input name="name" id="frmNameA" placeholder="Full name" required autocomplete="name">
<label for="frmEmailA">Email</label>
<input type="email" name="email" id="frmEmailA" placeholder="[email protected]" required autocomplete="email">
<label for="frmEmailC">Confirm Email</label>
<input type="email" name="emailC" id="frmEmailC" placeholder="[email protected]" required autocomplete="email">
<label for="frmPhoneNumA">Phone</label>
<input type="tel" name="phone" id="frmPhoneNumA" placeholder="+1-650-450-1212" required autocomplete="tel">
<datalist id="chocType">
<option value="white">
<option value="milk">
<option value="dark"></datalist>
</fieldset>
<fieldset>
<legend>Shipping</legend>
<label for="frmAddressS">Address</label>
<input name="ship-address" required id="frmAddressS" placeholder="123 Any Street" autocomplete="shipping street-address">
<label for="frmCityS">City</label>
<input name="ship-city" required id="frmCityS" placeholder="New York" autocomplete="shipping address-level2">
<label for="frmStateS">State</label>
<input name="ship-state" required id="frmStateS" placeholder="NY" autocomplete="shipping address-level1">
<label for="frmZipS">Zip</label>
<input name="ship-zip" required id="frmZipS" placeholder="10011" autocomplete="shipping postal-code">
<label for="frmCountryS">Country</label>
<input name="ship-country" required id="frmCountryS" placeholder="USA" autocomplete="shipping country">
<label>
<input type="checkbox" name="billAndShip" id="cbBillAndShip">
<br>Bill to this address.</label>
</fieldset>
<fieldset>
<legend>Billing</legend>
<label for="frmAddressB">Address</label>
<input name="bill-address" id="frmAddressB" required placeholder="123 Any Street" autocomplete="billing street-address">
<label for="frmCityB">City</label>
<input name="bill-city" id="frmCityB" required placeholder="New York" autocomplete="billing address-level2">
<label for="frmStateB">State</label>
<input name="bill-state" id="frmStateB" required placeholder="NY" autocomplete="billing address-level1">
<label for="frmZipB">Zip</label>
<input name="bill-zip" id="frmZipB" required placeholder="10011" autocomplete="billing postal-code">
<label for="frmCountryB">Country</label>
<input name="bill-country" id="frmCountryB" required placeholder="USA" autocomplete="billing country"></fieldset>
<div id="paymentSec">
<fieldset>
<legend>Payment</legend>
<p>
Do <b>NOT</b>
provide real credit card information in this field.
</p>
<label for="frmNameCC">Name on card</label>
<input name="ccname" id="frmNameCC" required placeholder="Full Name" autocomplete="cc-name">
<label for="frmCCNum">Card Number</label>
<input name="cardnumber" id="frmCCNum" required autocomplete="cc-number">
<label for="frmCCCVC">CVC</label>
<input name="cvc" id="frmCCCVC" required autocomplete="cc-csc">
<label for="frmCCExp">Expiry</label>
<input name="cc-exp" id="frmCCExp" required placeholder="MM-YYYY" autocomplete="cc-exp">
<div>
<button class="btn" id="butCheckout">Check Out</button>
</div>
</fieldset>
</div>
</form>
</div>
<!-- GA -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-53348325-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>