5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6 <meta name="description" content="">
7 <meta name="author" content="">
8 <link rel="icon" href="../../../../favicon.ico">
10 <title>Checkout example for Bootstrap</title>
12 <!-- Bootstrap core CSS -->
13 <link href="../../../../dist/css/bootstrap.min.css" rel="stylesheet">
15 <!-- Custom styles for this template -->
16 <link href="form-validation.css" rel="stylesheet">
19 <body class="bg-light">
21 <div class="container">
22 <div class="py-5 text-center">
23 <img class="d-block mx-auto mb-4" src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg" alt="" width="72" height="72">
24 <h2>Checkout form</h2>
25 <p class="lead">Below is an example form built entirely with Bootstrap's form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.</p>
29 <div class="col-md-4 order-md-2 mb-4">
30 <h4 class="d-flex justify-content-between align-items-center mb-3">
31 <span class="text-muted">Your cart</span>
32 <span class="badge badge-secondary badge-pill">3</span>
34 <ul class="list-group mb-3">
35 <li class="list-group-item d-flex justify-content-between lh-condensed">
37 <h6 class="my-0">Product name</h6>
38 <small class="text-muted">Brief description</small>
40 <span class="text-muted">$12</span>
42 <li class="list-group-item d-flex justify-content-between lh-condensed">
44 <h6 class="my-0">Second product</h6>
45 <small class="text-muted">Brief description</small>
47 <span class="text-muted">$8</span>
49 <li class="list-group-item d-flex justify-content-between lh-condensed">
51 <h6 class="my-0">Third item</h6>
52 <small class="text-muted">Brief description</small>
54 <span class="text-muted">$5</span>
56 <li class="list-group-item d-flex justify-content-between bg-light">
57 <div class="text-success">
58 <h6 class="my-0">Promo code</h6>
59 <small>EXAMPLECODE</small>
61 <span class="text-success">-$5</span>
63 <li class="list-group-item d-flex justify-content-between">
64 <span>Total (USD)</span>
69 <form class="card p-2">
70 <div class="input-group">
71 <input type="text" class="form-control" placeholder="Promo code">
72 <div class="input-group-append">
73 <button type="submit" class="btn btn-secondary">Redeem</button>
78 <div class="col-md-8 order-md-1">
79 <h4 class="mb-3">Billing address</h4>
80 <form class="needs-validation" novalidate>
82 <div class="col-md-6 mb-3">
83 <label for="firstName">First name</label>
84 <input type="text" class="form-control" id="firstName" placeholder="" value="" required>
85 <div class="invalid-feedback">
86 Valid first name is required.
89 <div class="col-md-6 mb-3">
90 <label for="lastName">Last name</label>
91 <input type="text" class="form-control" id="lastName" placeholder="" value="" required>
92 <div class="invalid-feedback">
93 Valid last name is required.
99 <label for="username">Username</label>
100 <div class="input-group">
101 <div class="input-group-prepend">
102 <span class="input-group-text">@</span>
104 <input type="text" class="form-control" id="username" placeholder="Username" required>
105 <div class="invalid-feedback" style="width: 100%;">
106 Your username is required.
112 <label for="email">Email <span class="text-muted">(Optional)</span></label>
113 <input type="email" class="form-control" id="email" placeholder="you@example.com">
114 <div class="invalid-feedback">
115 Please enter a valid email address for shipping updates.
120 <label for="address">Address</label>
121 <input type="text" class="form-control" id="address" placeholder="1234 Main St" required>
122 <div class="invalid-feedback">
123 Please enter your shipping address.
128 <label for="address2">Address 2 <span class="text-muted">(Optional)</span></label>
129 <input type="text" class="form-control" id="address2" placeholder="Apartment or suite">
133 <div class="col-md-5 mb-3">
134 <label for="country">Country</label>
135 <select class="custom-select d-block w-100" id="country" required>
136 <option value="">Choose...</option>
137 <option>United States</option>
139 <div class="invalid-feedback">
140 Please select a valid country.
143 <div class="col-md-4 mb-3">
144 <label for="state">State</label>
145 <select class="custom-select d-block w-100" id="state" required>
146 <option value="">Choose...</option>
147 <option>California</option>
149 <div class="invalid-feedback">
150 Please provide a valid state.
153 <div class="col-md-3 mb-3">
154 <label for="zip">Zip</label>
155 <input type="text" class="form-control" id="zip" placeholder="" required>
156 <div class="invalid-feedback">
162 <div class="custom-control custom-checkbox">
163 <input type="checkbox" class="custom-control-input" id="same-address">
164 <label class="custom-control-label" for="same-address">Shipping address is the same as my billing address</label>
166 <div class="custom-control custom-checkbox">
167 <input type="checkbox" class="custom-control-input" id="save-info">
168 <label class="custom-control-label" for="save-info">Save this information for next time</label>
172 <h4 class="mb-3">Payment</h4>
174 <div class="d-block my-3">
175 <div class="custom-control custom-radio">
176 <input id="credit" name="paymentMethod" type="radio" class="custom-control-input" checked required>
177 <label class="custom-control-label" for="credit">Credit card</label>
179 <div class="custom-control custom-radio">
180 <input id="debit" name="paymentMethod" type="radio" class="custom-control-input" required>
181 <label class="custom-control-label" for="debit">Debit card</label>
183 <div class="custom-control custom-radio">
184 <input id="paypal" name="paymentMethod" type="radio" class="custom-control-input" required>
185 <label class="custom-control-label" for="paypal">Paypal</label>
189 <div class="col-md-6 mb-3">
190 <label for="cc-name">Name on card</label>
191 <input type="text" class="form-control" id="cc-name" placeholder="" required>
192 <small class="text-muted">Full name as displayed on card</small>
193 <div class="invalid-feedback">
194 Name on card is required
197 <div class="col-md-6 mb-3">
198 <label for="cc-number">Credit card number</label>
199 <input type="text" class="form-control" id="cc-number" placeholder="" required>
200 <div class="invalid-feedback">
201 Credit card number is required
206 <div class="col-md-3 mb-3">
207 <label for="cc-expiration">Expiration</label>
208 <input type="text" class="form-control" id="cc-expiration" placeholder="" required>
209 <div class="invalid-feedback">
210 Expiration date required
213 <div class="col-md-3 mb-3">
214 <label for="cc-expiration">CVV</label>
215 <input type="text" class="form-control" id="cc-cvv" placeholder="" required>
216 <div class="invalid-feedback">
217 Security code required
222 <button class="btn btn-primary btn-lg btn-block" type="submit">Continue to checkout</button>
227 <footer class="my-5 pt-5 text-muted text-center text-small">
228 <p class="mb-1">© 2017-2018 Company Name</p>
229 <ul class="list-inline">
230 <li class="list-inline-item"><a href="#">Privacy</a></li>
231 <li class="list-inline-item"><a href="#">Terms</a></li>
232 <li class="list-inline-item"><a href="#">Support</a></li>
237 <!-- Bootstrap core JavaScript
238 ================================================== -->
239 <!-- Placed at the end of the document so the pages load faster -->
240 <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
241 <script>window.jQuery || document.write('<script src="../../../../assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
242 <script src="../../../../assets/js/vendor/popper.min.js"></script>
243 <script src="../../../../dist/js/bootstrap.min.js"></script>
244 <script src="../../../../assets/js/vendor/holder.min.js"></script>
246 // Example starter JavaScript for disabling form submissions if there are invalid fields
250 window.addEventListener('load', function() {
251 // Fetch all the forms we want to apply custom Bootstrap validation styles to
252 var forms = document.getElementsByClassName('needs-validation');
254 // Loop over them and prevent submission
255 var validation = Array.prototype.filter.call(forms, function(form) {
256 form.addEventListener('submit', function(event) {
257 if (form.checkValidity() === false) {
258 event.preventDefault();
259 event.stopPropagation();
261 form.classList.add('was-validated');