"Credit Card Payment Form #2"
Bootstrap 2.3.2 Snippet by msurguy

<div class="container"> <div class="row"> <div class="span12"> <form class="form-horizontal span6"> <fieldset> <legend>Payment</legend> <div class="control-group"> <label class="control-label">Card Holder's Name</label> <div class="controls"> <input type="text" class="input-block-level" pattern="\w+ \w+.*" title="Fill your first and last name" required> </div> </div> <div class="control-group"> <label class="control-label">Card Number</label> <div class="controls"> <div class="row-fluid"> <div class="span3"> <input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="\d{4}" title="First four digits" required> </div> <div class="span3"> <input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="\d{4}" title="Second four digits" required> </div> <div class="span3"> <input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="\d{4}" title="Third four digits" required> </div> <div class="span3"> <input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="\d{4}" title="Fourth four digits" required> </div> </div> </div> </div> <div class="control-group"> <label class="control-label">Card Expiry Date</label> <div class="controls"> <div class="row-fluid"> <div class="span9"> <select class="input-block-level"> <option>January</option> <option>...</option> <option>December</option> </select> </div> <div class="span3"> <select class="input-block-level"> <option>2013</option> <option>...</option> <option>2015</option> </select> </div> </div> </div> </div> <div class="control-group"> <label class="control-label">Card CVV</label> <div class="controls"> <div class="row-fluid"> <div class="span3"> <input type="text" class="input-block-level" autocomplete="off" maxlength="3" pattern="\d{3}" title="Three digits at back of your card" required> </div> <div class="span8"> <!-- screenshot may be here --> </div> </div> </div> </div> <div class="form-actions"> <button type="submit" class="btn btn-primary">Submit</button> <button type="button" class="btn">Cancel</button> </div> </fieldset> </form> </div> </div> </div>

Questions / Comments:

Jamie, I didn't read the comments but I did the same thing! Glad you put the maxlength in there for those LT IE 10 users and Safari people! I pretty much did the same thing but for the credit card.

For those of you who want to use one input field,
<input type="text" class="input-block-level" pattern="^[0-9]{13,16}$" autocomplete="off" maxlength="16" required="">

Or if you prefer the 4 input fields you could use:

<input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="^[0-9]{4}$" title="First four digits" required="">
<input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="^[0-9]{4}$" title="Second four digits" required="">
<input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="^[0-9]{4}$" title="Third four digits" required="">
<input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="^[0-9]{1,4}$" title="Last digits" required="">

And for futher information on HTML5 Patterns I found this to be a great resource.
http://html5pattern.com/

Curtis Morte (0) - 4 years ago - Reply 0


This will do it for the CVV

<input type="text" class="input-block-level" autocomplete="off" maxlength="4" pattern="^[0-9]{3,4}$" title="Three digits at back of your card" required="">

Jamie (0) - 4 years ago - Reply 0


=

Purevbazar Purevjav (0) - 4 years ago - Reply 0


I would suggest going to an existing website with a select that you are looking for and just copying the source code of it.
Or write a small PHP or Javascript code to generate it automatically.

maxsurguy (0) - 4 years ago - Reply 0


CVV only allows 3 digits? AX is 4...

Gerry (0) - 4 years ago - Reply 0


Card Expiry Date does not have day...

Александр Юрченко (0) - 4 years ago - Reply 0


thanks! Fixed!

maxsurguy (0) - 4 years ago - Reply 0


Related: See More