Permalink
Browse files

[e] (0) required='' example

git-svn-id: http://svn.whatwg.org/webapps@3817 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent 9e7c8c6 commit 5da50719a1759bd1f201ce6e6bb2ece7552ecaad @Hixie Hixie committed Sep 13, 2009
Showing with 46 additions and 0 deletions.
  1. +23 −0 index
  2. +23 −0 source
View
23 index
@@ -34863,6 +34863,29 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H
</div>
+ <div class=example>
+
+ <p>The following form has two required fields, one for an e-mail
+ address and one for a password. It also has a third field that is
+ only considerd valid if the user types the same password in the
+ password field and this third field.</p>
+
+ <pre>&lt;h1&gt;Create new account&lt;/h1&gt;
+&lt;form action="/newaccount" method=post&gt;
+ &lt;p&gt;
+ &lt;label for="username"&gt;E-mail address:&lt;/label&gt;
+ &lt;input id="username" type=email required name=un&gt;
+ &lt;p&gt;
+ &lt;label for="password1"&gt;Password:&lt;/label&gt;
+ &lt;input id="password1" type=password required name=up&gt;
+ &lt;p&gt;
+ &lt;label for="password2"&gt;Confirm password:&lt;/label&gt;
+ &lt;input id="password2" type=password onforminput="setCustomValidity(value != password1.value ? 'Passwords do not match.' : '')"&gt;
+ &lt;p&gt;
+ &lt;input type=submit value="Create account"&gt;
+&lt;/form&gt;</pre>
+
+ </div>
<h6 id=the-multiple-attribute><span class=secno>4.10.4.2.6 </span>The <code title=attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute</h6>
View
23 source
@@ -38765,6 +38765,29 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
</div>
+ <div class="example">
+
+ <p>The following form has two required fields, one for an e-mail
+ address and one for a password. It also has a third field that is
+ only considerd valid if the user types the same password in the
+ password field and this third field.</p>
+
+ <pre>&lt;h1>Create new account&lt;/h1>
+&lt;form action="/newaccount" method=post>
+ &lt;p>
+ &lt;label for="username">E-mail address:&lt;/label>
+ &lt;input id="username" type=email required name=un>
+ &lt;p>
+ &lt;label for="password1">Password:&lt;/label>
+ &lt;input id="password1" type=password required name=up>
+ &lt;p>
+ &lt;label for="password2">Confirm password:&lt;/label>
+ &lt;input id="password2" type=password onforminput="setCustomValidity(value != password1.value ? 'Passwords do not match.' : '')">
+ &lt;p>
+ &lt;input type=submit value="Create account">
+&lt;/form></pre>
+
+ </div>
<h6>The <code title="attr-input-multiple">multiple</code> attribute</h6>

0 comments on commit 5da5071

Please sign in to comment.