This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #753 from petele/master
Updated forms article (for issue #482)
- Loading branch information
Showing
12 changed files
with
570 additions
and
530 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
126 changes: 126 additions & 0 deletions
126
content/tutorials/forms/html5forms/static/input-types.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Request To Cross Bridge</title> | ||
|
||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css"> | ||
|
||
<style type="text/css"> | ||
|
||
body { | ||
background-color: #eee; | ||
} | ||
|
||
input:invalid { | ||
border-color: #b94a48; | ||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); | ||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); | ||
} | ||
|
||
input:valid { | ||
border-color: #468847; | ||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); | ||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
<div class="container"> | ||
|
||
<form class="form-bridge"> | ||
<h2>Before you may cross the bridge, you must answer these questions!</h2> | ||
<div class="form-group"> | ||
<label for="first_last">WHAT, is your name?</label> | ||
<input type="text" class="form-control" id="first_last" placeholder="First Last" required autofocus autocomplete="on"> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email_addr">WHAT, is your email address?</label> | ||
<input type="email" class="form-control" id="email_addr" placeholder="Email address" required> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email_addr_confirm">WHAT, is your email address? Again!</label> | ||
<input type="email" class="form-control" id="email_addr_confirm" placeholder="Confirm email address" required autocomplete="off"> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="fav_website">WHAT, is your favorite website?</label> | ||
<input type="url" class="form-control" id="fav_website" placeholder="Favorite website" required> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="fav_pizza">WHAT, is the phone number of your favorite pizza place?</label> | ||
<input type="tel" class="form-control" id="fav_pizza" placeholder="+1-416-967-1111"> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="dob">WHAT, is your date of birth?</label> | ||
<input type="date" class="form-control" id="dob"> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="age">WHAT, is your age?</label> | ||
<input type="number" class="form-control" id="age" placeholder="Age" min="1" max="110" required> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="color">WHAT, is your favorite color?</label> | ||
<input type="color" class="form-control" id="color"> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="chocolate">WHAT, is your favorite kind of chocolate?</label> | ||
<input type="text" class="form-control" id="chocolate" list="chocType"> | ||
<span class="help-block"></span> | ||
<datalist id="chocType"> | ||
<option value="white" /> | ||
<option value="milk" /> | ||
<option value="dark" /> | ||
</datalist> | ||
</div> | ||
<div class="form-group"> | ||
<label for="part_number">WHAT, is the part number of a <a href="http://goo.gl/0CNgfD">3/4" Philips Head machine screw</a>?</label> | ||
<input type="text" class="form-control" id="part_number" placeholder="XXX9999XX" pattern="[A-Z,a-z]{3}[0-9]{4}[A-Z,a-z]{2}"> | ||
<span class="help-block"></span> | ||
</div> | ||
<div class="form-group"> | ||
<label for="airspeed_velocity">WHAT, is the airspeed velocity of an unladen swallow? <span id="asv">1</span> (m/s)</label> | ||
<input type="range" class="form-control" id="airspeed_velocity" min="1" max="50" step="1" value="1"> | ||
<span class="help-block"></span> | ||
</div> | ||
|
||
|
||
<button class="btn btn-lg btn-primary btn-block" type="submit">Cross the bridge</button> | ||
</form> | ||
|
||
</div> <!-- /container --> | ||
|
||
<script type="text/javascript"> | ||
document.getElementById("email_addr_confirm").addEventListener("input", verifyEmail); | ||
document.getElementById("airspeed_velocity").addEventListener("input", showAirspeed); | ||
|
||
function verifyEmail(input) { | ||
input = input.srcElement; | ||
if (input.value != document.getElementById('email_addr').value) { | ||
input.setCustomValidity('The two email addresses must match.'); | ||
} else { | ||
input.setCustomValidity(''); | ||
} | ||
input.nextElementSibling.innerText = input.validationMessage; | ||
} | ||
|
||
function showAirspeed(input) { | ||
input = input.srcElement; | ||
document.getElementById("asv").innerText = input.valueAsNumber; | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters