W3C home > Mailing lists > Public > public-html-diffs@w3.org > May 2012

hixie: example for type=number (whatwg r7091)

From: poot <cvsmail@w3.org>
Date: Mon, 07 May 2012 18:13:51 -0400
To: public-html-diffs@w3.org
Message-Id: <E1SRWBj-00086d-BQ@jay.w3.org>
hixie: example for type=number (whatwg r7091)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.5647&r2=1.5648&f=h
http://html5.org/tools/web-apps-tracker?from=7090&to=7091

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.5647
retrieving revision 1.5648
diff -u -d -r1.5647 -r1.5648
--- Overview.html	7 May 2012 22:05:37 -0000	1.5647
+++ Overview.html	7 May 2012 22:13:41 -0000	1.5648
@@ -41032,6 +41032,29 @@
 
   </div>
 
+  <div class="example">
+
+   <p>Here is an example of using a numeric input control:</p>
+
+   <pre>&lt;label&gt;How much do you want to charge? $&lt;input type=number min=0 step=0.01 name=price&gt;&lt;/label&gt;</pre>
+
+  </div>
+
+  <p class="note">The <code title="">type=number</code> state is not
+  appropriate for input that happens to only consist of numbers but
+  isn't strictly speaking a number. For example, it would be
+  inappropriate for credit card numbers or US postal codes. A simple
+  way of determining whether to use <code title="">type=number</code>
+  is to consider whether it would make sense for the input control to
+  have a spinbox interface (e.g. with "up" and "down" arrows). Getting
+  a credit card number wrong by 1 in the last digit isn't a minor
+  mistake, it's as wrong as getting every digit incorrect. So it would
+  not make sense for the user to select a credit card number using
+  "up" and "down" buttons. When a spinbox interface is not
+  appropriate, <code title="">type=text</code> is probably the right
+  choice (possibly with a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute).</p>
+
+
 
   <h6 id="range-state-type-range"><span class="secno">4.10.7.1.14 </span><dfn title="attr-input-type-range">Range</dfn> state (<code title="">type=range</code>)</h6>
Received on Monday, 7 May 2012 22:13:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 May 2012 22:13:54 GMT