HTML Standard Tracker


File a bug

SVNBugCommentTime (UTC)
3817required='' example2009-09-13 07:34
@@ -38758,20 +38758,43 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
   title="concept-input-required">required</i>, and its <code
   title="dom-input-value">value</code> IDL attribute applies and is in
   the mode <span title="dom-input-value-value">value</span>, and the
   element is <i title="concept-input-mutable">mutable</i>, and the
   element's <span title="concept-fe-value">value</span> is the empty
   string, then the element is <span>suffering from being
+  <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">
+  </div>
   <h6>The <code title="attr-input-multiple">multiple</code> attribute</h6>
   <p>The <dfn title="attr-input-multiple"><code>multiple</code></dfn>
   attribute is a <span>boolean attribute</span> that indicates whether
   the user is to be allowed to specify more than one value.</p>