Annotation of html5/spec/common-input-element-attributes.html, revision 1.190

1.154     mike        1: <!DOCTYPE html>
1.162     mike        2: <html lang="en-US-x-Hixie"><head><title>4.10.7.3 Common input element attributes &#8212; HTML5</title><link rel="stylesheet" href="alert.css"><style type="text/css">
1.1       mike        3:    pre { margin-left: 2em; white-space: pre-wrap; }
                      4:    h2 { margin: 3em 0 1em 0; }
                      5:    h3 { margin: 2.5em 0 1em 0; }
                      6:    h4 { margin: 2.5em 0 0.75em 0; }
                      7:    h5, h6 { margin: 2.5em 0 1em; }
                      8:    h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
                      9:    h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
                     10:    p { margin: 1em 0; }
                     11:    hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
                     12:    dl, dd { margin-top: 0; margin-bottom: 0; }
                     13:    dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
                     14:    dt + dt { margin-top: 0; }
                     15:    dd dt { margin-top: 0.25em; margin-bottom: 0; }
                     16:    dd p { margin-top: 0; }
                     17:    dd dl + p { margin-top: 1em; }
                     18:    dd table + p { margin-top: 1em; }
                     19:    p + * > li, dd li { margin: 1em 0; }
                     20:    dt, dfn { font-weight: bold; font-style: normal; }
1.52      mike       21:    i, em { font-style: italic; }
1.1       mike       22:    dt dfn { font-style: italic; }
                     23:    pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
                     24:    pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
                     25:    pre em { font-weight: bolder; font-style: normal; }
                     26:    @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
                     27:    var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
                     28:    table { border-collapse: collapse; border-style: hidden hidden none hidden; }
                     29:    table thead, table tbody { border-bottom: solid; }
                     30:    table tbody th:first-child { border-left: solid; }
                     31:    table tbody th { text-align: left; }
                     32:    table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
                     33:    blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
                     34: 
                     35:    .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
                     36:    .matrix, .matrix td { border: none; text-align: right; }
                     37:    .matrix { margin-left: 2em; }
                     38:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                     39:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                     40:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                     41: 
                     42:    .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
1.56      mike       43:    img.extra, p.overview { float: right; }
1.55      mike       44:    pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
1.1       mike       45:    pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
1.55      mike       46:    pre.idl::before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
1.1       mike       47:    pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
                     48:    pre.css:first-line { color: #AAAA50; }
                     49:    dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
                     50:    hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
                     51:    dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
                     52:    dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
                     53:    dl.domintro dd p { margin: 0.5em 0; }
1.63      mike       54:    dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
1.1       mike       55:    dl.switch { padding-left: 2em; }
                     56:    dl.switch > dt { text-indent: -1.5em; }
                     57:    dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
                     58:    dl.triple { padding: 0 0 0 1em; }
                     59:    dl.triple dt, dl.triple dd { margin: 0; display: inline }
                     60:    dl.triple dt:after { content: ':'; }
                     61:    dl.triple dd:after { content: '\A'; white-space: pre; }
                     62:    .diff-old { text-decoration: line-through; color: silver; background: transparent; }
                     63:    .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
                     64:    a .diff-new { border-bottom: 1px blue solid; }
                     65: 
                     66:    h2 { page-break-before: always; }
                     67:    h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
                     68:    h1 + h2, hr + h2.no-toc { page-break-before: auto; }
                     69: 
1.20      mike       70:    p  > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
                     71:    li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
1.1       mike       72: 
                     73:    div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
                     74:    div.head p { margin: 0; }
                     75:    div.head h1 { margin: 0; }
                     76:    div.head .logo { float: right; margin: 0 1em; }
                     77:    div.head .logo img { border: none } /* remove border from top image */
                     78:    div.head dl { margin: 1em 0; }
                     79:    div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
                     80: 
                     81:    body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
                     82:    body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
                     83:    body > .toc > li > * { margin-bottom: 0.5em; }
                     84:    body > .toc > li > * > li > * { margin-bottom: 0.25em; }
                     85:    .toc, .toc li { list-style: none; }
                     86: 
                     87:    .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
                     88:    .brief li { margin: 0; padding: 0; }
                     89:    .brief li p { margin: 0; padding: 0; }
                     90: 
                     91:    .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
                     92:    .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
                     93:    .category-list li { display: inline; }
                     94:    .category-list li:not(:last-child)::after { content: ', '; }
                     95:    .category-list li > span, .category-list li > a { text-transform: lowercase; }
                     96:    .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
                     97: 
                     98:    .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
                     99:    .XXX > :first-child { margin-top: 0; }
                    100:    p .XXX { line-height: 3em; }
                    101:    .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
                    102:    .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
                    103:    .annotation :link, .annotation :visited { color: inherit; }
                    104:    .annotation :link:hover, .annotation :visited:hover { background: transparent; }
                    105:    .annotation span { border: none ! important; }
                    106:    .note { color: green; background: transparent; font-family: sans-serif; }
                    107:    .warning { color: red; background: transparent; }
                    108:    .note, .warning { font-weight: bolder; font-style: italic; }
1.52      mike      109:    .note em, .warning em, .note i, .warning i { font-style: normal; }
1.1       mike      110:    p.note, div.note { padding: 0.5em 2em; }
                    111:    span.note { padding: 0 2em; }
                    112:    .note p:first-child, .warning p:first-child { margin-top: 0; }
                    113:    .note p:last-child, .warning p:last-child { margin-bottom: 0; }
                    114:    .warning:before { font-style: normal; }
                    115:    p.note:before { content: 'Note: '; }
                    116:    p.warning:before { content: '\26A0 Warning! '; }
                    117: 
                    118:    .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
                    119:    .bookkeeping { font-size: 0.8em; margin: 2em 0; }
                    120:    .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
1.10      mike      121:    .bookkeeping dt { margin: 0.5em 2em 0; }
                    122:    .bookkeeping dd { margin: 0 3em 0.5em; }
1.1       mike      123: 
                    124:    h4 { position: relative; z-index: 3; }
                    125:    h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
                    126:    .element {
                    127:      background: #EEEEFF;
                    128:      color: black;
                    129:      margin: 0 0 1em 0.15em;
                    130:      padding: 0 1em 0.25em 0.75em;
                    131:      border-left: solid #9999FF 0.25em;
                    132:      position: relative;
                    133:      z-index: 1;
                    134:    }
                    135:    .element:before {
                    136:      position: absolute;
                    137:      z-index: 2;
                    138:      top: 0;
                    139:      left: -1.15em;
                    140:      height: 2em;
                    141:      width: 0.9em;
                    142:      background: #EEEEFF;
                    143:      content: ' ';
                    144:      border-style: none none solid solid;
                    145:      border-color: #9999FF;
                    146:      border-width: 0.25em;
                    147:    }
                    148: 
                    149:    .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
                    150:    td > .example:only-child { margin: 0 0 0 0.1em; }
                    151: 
                    152:    ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
                    153:    ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
                    154:    ul.domTree li li { list-style: none; }
                    155:    ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
                    156:    ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
                    157:    ul.domTree span { font-style: italic; font-family: serif; }
                    158:    ul.domTree .t1 code { color: purple; font-weight: bold; }
                    159:    ul.domTree .t2 { font-style: normal; font-family: monospace; }
                    160:    ul.domTree .t2 .name { color: black; font-weight: bold; }
                    161:    ul.domTree .t2 .value { color: blue; font-weight: normal; }
                    162:    ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
                    163:    ul.domTree .t7 code, .domTree .t8 code { color: green; }
                    164:    ul.domTree .t10 code { color: teal; }
                    165: 
                    166:    body.dfnEnabled dfn { cursor: pointer; }
                    167:    .dfnPanel {
                    168:      display: inline;
                    169:      position: absolute;
                    170:      z-index: 10;
                    171:      height: auto;
                    172:      width: auto;
                    173:      padding: 0.5em 0.75em;
                    174:      font: small sans-serif, Droid Sans Fallback;
                    175:      background: #DDDDDD;
                    176:      color: black;
                    177:      border: outset 0.2em;
                    178:    }
                    179:    .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
                    180:    .dfnPanel :link, .dfnPanel :visited { color: black; }
                    181:    .dfnPanel p { font-weight: bolder; }
                    182:    .dfnPanel * + p { margin-top: 0.25em; }
                    183:    .dfnPanel li { list-style-position: inside; }
                    184: 
                    185:    #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
                    186:    #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
                    187:    #configUI p label { display: block; }
                    188:    #configUI #updateUI, #configUI .loginUI { text-align: center; }
                    189:    #configUI input[type=button] { display: block; margin: auto; }
1.8       mike      190: 
1.24      mike      191:    fieldset { margin: 1em; padding: 0.5em 1em; }
                    192:    fieldset > legend + * { margin-top: 0; }
1.19      mike      193:    fieldset > :last-child { margin-bottom: 0; }
1.24      mike      194:    fieldset p { margin: 0.5em 0; }
                    195: 
1.180     mike      196:   </style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><meta content="noindex" name="robots"><style type="text/css">
1.1       mike      197: 
                    198:    .applies thead th > * { display: block; }
                    199:    .applies thead code { display: block; }
                    200:    .applies tbody th { whitespace: nowrap; }
                    201:    .applies td { text-align: center; }
                    202:    .applies .yes { background: yellow; }
                    203: 
1.11      mike      204:    .matrix, .matrix td { border: hidden; text-align: right; }
1.1       mike      205:    .matrix { margin-left: 2em; }
                    206: 
                    207:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                    208:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                    209:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                    210: 
1.16      mike      211:    td.eg { border-width: thin; text-align: center; }
                    212: 
1.1       mike      213:    #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
                    214:    #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
                    215:    #table-example-1 caption { padding-bottom: 0.5em; }
                    216:    #table-example-1 thead, #table-example-1 tbody { border: none; }
                    217:    #table-example-1 th, #table-example-1 td { border: solid thin; }
                    218:    #table-example-1 th { font-weight: normal; }
                    219:    #table-example-1 td { border-style: none solid; vertical-align: top; }
                    220:    #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
                    221:    #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
                    222:    #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
                    223:    #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
                    224:    #table-example-1 tbody td:first-child::after { content: leader(". "); }
                    225:    #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
                    226:    #table-example-1 tbody td:first-child + td { width: 10em; }
                    227:    #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
                    228:    #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
                    229: 
                    230:    .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
                    231:    .apple-table-examples * { font-family: "Times", serif; }
                    232:    .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
                    233:    .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
                    234:    .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
                    235:    .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
                    236:    .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
                    237:    .apple-table-examples td { text-align: right; vertical-align: top; }
                    238:    .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
                    239:    .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
                    240:    .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
                    241:    .apple-table-examples sup { line-height: 0; }
                    242: 
                    243:    .details-example img { vertical-align: top; }
                    244: 
1.32      mike      245:    #base64-table {
                    246:      white-space: nowrap;
                    247:      font-size: 0.6em;
                    248:      column-width: 6em;
                    249:      column-count: 5;
                    250:      column-gap: 1em;
                    251:      -moz-column-width: 6em;
                    252:      -moz-column-count: 5;
                    253:      -moz-column-gap: 1em;
                    254:      -webkit-column-width: 6em;
                    255:      -webkit-column-count: 5;
                    256:      -webkit-column-gap: 1em;
                    257:    }
                    258:    #base64-table thead { display: none; }
                    259:    #base64-table * { border: none; }
                    260:    #base64-table tbody td:first-child:after { content: ':'; }
                    261:    #base64-table tbody td:last-child { text-align: right; }
                    262: 
1.1       mike      263:    #named-character-references-table {
1.18      mike      264:      white-space: nowrap;
1.1       mike      265:      font-size: 0.6em;
1.18      mike      266:      column-width: 30em;
1.1       mike      267:      column-gap: 1em;
1.18      mike      268:      -moz-column-width: 30em;
1.1       mike      269:      -moz-column-gap: 1em;
1.18      mike      270:      -webkit-column-width: 30em;
1.1       mike      271:      -webkit-column-gap: 1em;
                    272:    }
1.18      mike      273:    #named-character-references-table > table > tbody > tr > td:first-child + td,
1.1       mike      274:    #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
                    275:    #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
1.18      mike      276:    #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
1.1       mike      277: 
1.2       mike      278:    .glyph.control { color: red; }
                    279: 
1.4       mike      280:    @font-face {
                    281:      font-family: 'Essays1743';
                    282:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
                    283:    }
                    284:    @font-face {
                    285:      font-family: 'Essays1743';
                    286:      font-weight: bold;
                    287:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
                    288:    }
                    289:    @font-face {
                    290:      font-family: 'Essays1743';
                    291:      font-style: italic;
                    292:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
                    293:    }
                    294:    @font-face {
                    295:      font-family: 'Essays1743';
                    296:      font-style: italic;
                    297:      font-weight: bold;
                    298:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
                    299:    }
                    300: 
1.47      mike      301:   </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script type="text/javascript">
1.38      mike      302:    function getCookie(name) {
                    303:      var params = location.search.substr(1).split("&");
                    304:      for (var index = 0; index < params.length; index++) {
                    305:        if (params[index] == name)
                    306:          return "1";
                    307:        var data = params[index].split("=");
                    308:        if (data[0] == name)
                    309:          return unescape(data[1]);
                    310:      }
                    311:      var cookies = document.cookie.split("; ");
                    312:      for (var index = 0; index < cookies.length; index++) {
                    313:        var data = cookies[index].split("=");
                    314:        if (data[0] == name)
                    315:          return unescape(data[1]);
                    316:      }
                    317:      return null;
                    318:    }
1.162     mike      319:   </script>
1.1       mike      320:   <script src="link-fixup.js"></script>
1.74      mike      321:   <link href="states-of-the-type-attribute.html" title="4.10.7.1 States of the type attribute" rel="prev">
1.67      mike      322:   <link href="index.html#contents" title="Table of contents" rel="contents">
1.99      mike      323:   <link href="common-input-element-apis.html" title="4.10.7.4 Common input element APIs" rel="next">
1.88      mike      324:   </head><body onload="fixBrokenLink();" class="split chapter"><div class="head" id="head">
1.1       mike      325:    <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.3       mike      326: 
1.1       mike      327:    <h1>HTML5</h1>
1.190   ! mike      328:    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2><p>This is revision 1.5650.</p>
1.67      mike      329: 
1.188     mike      330:    <h2 class="no-num no-toc" id="editor-s-draft-7-may-2012">Editor's Draft 7 May 2012</h2>
1.151     mike      331:    </div>
                    332: 
                    333:   <nav class="prev_next">
1.74      mike      334:    <a href="states-of-the-type-attribute.html">&#8592; 4.10.7.1 States of the type attribute</a> &#8211;
1.67      mike      335:    <a href="index.html#contents">Table of contents</a> &#8211;
1.99      mike      336:    <a href="common-input-element-apis.html">4.10.7.4 Common input element APIs &#8594;</a>
                    337:   <ol class="toc"><li><ol><li><ol><li><ol><li><a href="common-input-element-attributes.html#common-input-element-attributes"><span class="secno">4.10.7.3 </span>Common <code>input</code> element attributes</a>
                    338:         <ol><li><a href="common-input-element-attributes.html#the-autocomplete-attribute"><span class="secno">4.10.7.3.1 </span>The <code title="attr-input-autocomplete">autocomplete</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-dirname-attribute"><span class="secno">4.10.7.3.2 </span>The <code title="attr-input-dirname">dirname</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-list-attribute"><span class="secno">4.10.7.3.3 </span>The <code title="attr-input-list">list</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-readonly-attribute"><span class="secno">4.10.7.3.4 </span>The <code title="attr-input-readonly">readonly</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-size-attribute"><span class="secno">4.10.7.3.5 </span>The <code title="attr-input-size">size</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-required-attribute"><span class="secno">4.10.7.3.6 </span>The <code title="attr-input-required">required</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-multiple-attribute"><span class="secno">4.10.7.3.7 </span>The <code title="attr-input-multiple">multiple</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-maxlength-attribute"><span class="secno">4.10.7.3.8 </span>The <code title="attr-input-maxlength">maxlength</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-pattern-attribute"><span class="secno">4.10.7.3.9 </span>The <code title="attr-input-pattern">pattern</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-min-and-max-attributes"><span class="secno">4.10.7.3.10 </span>The <code title="attr-input-min">min</code> and <code title="attr-input-max">max</code> attributes</a></li><li><a href="common-input-element-attributes.html#the-step-attribute"><span class="secno">4.10.7.3.11 </span>The <code title="attr-input-step">step</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-placeholder-attribute"><span class="secno">4.10.7.3.12 </span>The <code title="attr-input-placeholder">placeholder</code> attribute</a></li></ol></li></ol></li></ol></li></ol></li></ol></nav>
1.1       mike      339: 
1.151     mike      340:   <h5 id="common-input-element-attributes"><span class="secno">4.10.7.3 </span>Common <code><a href="the-input-element.html#the-input-element">input</a></code> element attributes</h5>
                    341: 
                    342:   <div class="impl">
1.1       mike      343: 
                    344:   <p>These attributes only apply to an <code><a href="the-input-element.html#the-input-element">input</a></code> element if
                    345:   its <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute is in a
                    346:   state whose definition declares that the attribute applies. When an
1.85      mike      347:   attribute <dfn id="do-not-apply" title="do not apply">doesn't apply</dfn> to an
                    348:   <code><a href="the-input-element.html#the-input-element">input</a></code> element, user agents must <a href="infrastructure.html#ignore">ignore</a> the
                    349:   attribute, regardless of the requirements and definitions
                    350:   below.</p>
1.1       mike      351: 
1.151     mike      352:   </div>
                    353: 
                    354: 
                    355:   <h6 id="the-autocomplete-attribute"><span class="secno">4.10.7.3.1 </span>The <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code> attribute</h6>
                    356: 
                    357:   <p>User agents sometimes have features for helping users fill forms
1.1       mike      358:   in, for example prefilling the user's address based on earlier user
1.151     mike      359:   input.</p>
                    360: 
                    361:   <p>The <dfn id="attr-input-autocomplete" title="attr-input-autocomplete"><code>autocomplete</code></dfn>
1.1       mike      362:   attribute is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a>. The attribute has
                    363:   three states. The <code title="attr-input-autocomplete-on">on</code>
                    364:   keyword maps to the <dfn id="attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</dfn> state, and the
                    365:   <code title="attr-input-autocomplete-off">off</code> keyword maps to
                    366:   the <dfn id="attr-input-autocomplete-off-state" title="attr-input-autocomplete-off-state">off</dfn>
                    367:   state. The attribute may also be omitted. The <i>missing value
                    368:   default</i> is the <dfn id="attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</dfn>
1.151     mike      369:   state.</p>
                    370: 
                    371:   <p>The <a href="#attr-input-autocomplete-off-state" title="attr-input-autocomplete-off-state">off</a>
1.1       mike      372:   state indicates either that the control's input data is particularly
                    373:   sensitive (for example the activation code for a nuclear weapon); or
                    374:   that it is a value that will never be reused (for example a
                    375:   one-time-key for a bank login) and the user will therefore have to
                    376:   explicitly enter the data each time, instead of being able to rely
                    377:   on the UA to prefill the value for him; or that the document
                    378:   provides its own autocomplete mechanism and does not want the user
1.151     mike      379:   agent to provide autocompletion values.</p>
                    380: 
                    381:   <p>Conversely, the <a href="#attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</a> state indicates
1.1       mike      382:   that the value is not particularly sensitive and the user can expect
                    383:   to be able to rely on his user agent to remember values he has
1.151     mike      384:   entered for that control.</p>
                    385: 
                    386:   <p>The <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state
1.67      mike      387:   indicates that the user agent is to use the <code title="attr-form-autocomplete"><a href="the-form-element.html#attr-form-autocomplete">autocomplete</a></code> attribute on the
                    388:   element's <a href="association-of-controls-and-forms.html#form-owner">form owner</a> instead. (By default, the <code title="attr-form-autocomplete"><a href="the-form-element.html#attr-form-autocomplete">autocomplete</a></code> attribute of
1.151     mike      389:   <code><a href="the-form-element.html#the-form-element">form</a></code> elements is in the <a href="the-form-element.html#attr-form-autocomplete-on-state" title="attr-form-autocomplete-on-state">on</a> state.)</p>
                    390: 
                    391:   <div class="impl">
1.1       mike      392: 
                    393:   <p>Each <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <dfn id="resulting-autocompletion-state">resulting
                    394:   autocompletion state</dfn>, which is either <i title="">on</i> or <i title="">off</i>.</p>
                    395: 
                    396:   <p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element is in one of the following
                    397:   conditions, the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting
                    398:   autocompletion state</a> is <i title="">on</i>; otherwise, the
                    399:   <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting autocompletion
                    400:   state</a> is <i title="">off</i>:</p>
                    401: 
                    402:   <ul class="brief"><li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    403:    attribute is in the <a href="#attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</a> state.</li>
                    404: 
                    405:    <li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    406:    attribute is in the <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state,
                    407:    and the element has no <a href="association-of-controls-and-forms.html#form-owner">form owner</a>.</li>
                    408: 
                    409:    <li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    410:    attribute is in the <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state,
1.67      mike      411:    and the element's <a href="association-of-controls-and-forms.html#form-owner">form owner</a>'s <code title="attr-form-autocomplete"><a href="the-form-element.html#attr-form-autocomplete">autocomplete</a></code> attribute is in
                    412:    the <a href="the-form-element.html#attr-form-autocomplete-on-state" title="attr-form-autocomplete-on-state">on</a>
1.1       mike      413:    state.</li>
                    414: 
                    415:   </ul><p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting
                    416:   autocompletion state</a> is <i title="">on</i>, the user agent
                    417:   may store the value entered by the user so that if the user returns
                    418:   to the page, the UA can prefill the form. Otherwise, the user agent
1.67      mike      419:   should not remember the control's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, and should not offer past
1.1       mike      420:   values to the user.</p>
                    421: 
                    422:   <p>In addition, if the <a href="#resulting-autocompletion-state">resulting autocompletion state</a>
                    423:   is <i title="">off</i>, <a href="history.html#history-autocomplete">values are
                    424:   reset</a> when <a href="history.html#traverse-the-history" title="traverse the history">traversing the
                    425:   history</a>.</p>
                    426: 
                    427:   <p>The autocompletion mechanism must be implemented by the user
1.67      mike      428:   agent acting as if the user had modified the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, and must be done at a time
1.1       mike      429:   where the element is <i title="concept-input-mutable"><a href="the-input-element.html#concept-input-mutable">mutable</a></i>
                    430:   (e.g. just after the element has been inserted into the document, or
1.58      mike      431:   when the user agent <a href="the-end.html#stop-parsing" title="stop parsing">stops
1.1       mike      432:   parsing</a>).</p>
                    433: 
1.151     mike      434:   </div>
                    435: 
                    436:   <div class="example">
1.1       mike      437: 
                    438:    <p>Banks frequently do not want UAs to prefill login
                    439:    information:</p>
                    440: 
                    441:    <pre>&lt;p&gt;&lt;label&gt;Account: &lt;input type="text" name="ac" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;
                    442: &lt;p&gt;&lt;label&gt;PIN: &lt;input type="password" name="pin" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;</pre>
                    443: 
1.151     mike      444:   </div>
                    445: 
                    446:   <div class="impl">
1.1       mike      447: 
                    448:   <p>A user agent may allow the user to override the <a href="#resulting-autocompletion-state">resulting
                    449:   autocompletion state</a> and set it to always <i title="">on</i>,
1.60      mike      450:   always allowing values to be remembered and prefilled, or always <i title="">off</i>, never remembering values. However, user agents
                    451:   should not allow users to trivially override the <a href="#resulting-autocompletion-state">resulting
                    452:   autocompletion state</a> to <i title="">on</i>, as there are
1.1       mike      453:   significant security implications for the user if all values are
                    454:   always remembered, regardless of the site's preferences.</p>
                    455: 
1.151     mike      456:   </div>
                    457: 
                    458: 
                    459:   <h6 id="the-dirname-attribute"><span class="secno">4.10.7.3.2 </span>The <code title="attr-input-dirname"><a href="#attr-input-dirname">dirname</a></code> attribute</h6>
                    460: 
                    461:   <p>The <dfn id="attr-input-dirname" title="attr-input-dirname"><code>dirname</code></dfn>
                    462:   attribute, when it applies, is a <a href="attributes-common-to-form-controls.html#form-control-dirname-attribute">form control <code title="">dirname</code> attribute</a>.</p>
                    463: 
                    464:   <div class="example">
1.25      mike      465: 
                    466:    <p>In this example, a form contains a text field and a submission
                    467:    button:</p>
                    468: 
                    469:    <pre>&lt;form action="addcomment.cgi" method=post&gt;
                    470:  &lt;p&gt;&lt;label&gt;Comment: &lt;input type=text name="comment" dirname="comment.dir" required&gt;&lt;/label&gt;&lt;/p&gt;
                    471:  &lt;p&gt;&lt;button name="mode" type=submit value="add"&gt;Post Comment&lt;/button&gt;&lt;/p&gt;
                    472: &lt;/form&gt;</pre>
                    473: 
                    474:    <p>When the user submits the form, the user agent includes three
                    475:    fields, one called "comment", one called "comment.dir", and one
                    476:    called "mode"; so if the user types "Hello", the submission body
                    477:    might be something like:</p>
                    478: 
                    479:    <pre>comment=Hello&amp;<strong>comment.dir=ltr</strong>&amp;mode=add</pre>
                    480: 
                    481:    <p>If the user manually switches to a right-to-left writing
                    482:    direction and enters "<span dir="rtl" lang="ar" title="">&#1605;&#1585;&#1581;&#1576;&#1611;&#1575;</span>", the
                    483:    submission body might be something like:</p>
                    484: 
                    485:    <pre>comment=%D9%85%D8%B1%D8%AD%D8%A8%D9%8B%D8%A7&amp;<strong>comment.dir=rtl</strong>&amp;mode=add</pre>
                    486: 
1.151     mike      487:   </div>
                    488: 
                    489: 
                    490:   <h6 id="the-list-attribute"><span class="secno">4.10.7.3.3 </span>The <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute</h6>
                    491: 
                    492:   <p>The <dfn id="attr-input-list" title="attr-input-list"><code>list</code></dfn>
1.1       mike      493:   attribute is used to identify an element that lists predefined
1.151     mike      494:   options suggested to the user.</p>
                    495: 
                    496:   <p>If present, its value must be the <a href="infrastructure.html#concept-id" title="concept-id">ID</a> of a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element in
                    497:   the same document.</p>
                    498: 
                    499:   <div class="impl">
1.1       mike      500: 
                    501:   <p>The <dfn id="concept-input-list" title="concept-input-list">suggestions source
                    502:   element</dfn> is the first element in the document in <a href="infrastructure.html#tree-order">tree
1.62      mike      503:   order</a> to have an <a href="infrastructure.html#concept-id" title="concept-id">ID</a> equal to
1.30      mike      504:   the value of the <code title="attr-input-list"><a href="#attr-input-list">list</a></code>
1.67      mike      505:   attribute, if that element is a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element. If
1.30      mike      506:   there is no <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute, or
1.62      mike      507:   if there is no element with that <a href="infrastructure.html#concept-id" title="concept-id">ID</a>,
                    508:   or if the first element with that <a href="infrastructure.html#concept-id" title="concept-id">ID</a>
1.67      mike      509:   is not a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element, then there is no <a href="#concept-input-list" title="concept-input-list">suggestions source element</a>.</p>
1.1       mike      510: 
                    511:   <p>If there is a <a href="#concept-input-list" title="concept-input-list">suggestions source
                    512:   element</a>, then, when the user agent is allowing the user to
1.67      mike      513:   edit the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, the user agent should offer
1.1       mike      514:   the suggestions represented by the <a href="#concept-input-list" title="concept-input-list">suggestions source element</a> to the
                    515:   user in a manner suitable for the type of control used. The user
1.67      mike      516:   agent may use the suggestion's <a href="the-option-element.html#concept-option-label" title="concept-option-label">label</a> to identify the suggestion
1.30      mike      517:   if appropriate.</p>
1.1       mike      518: 
1.30      mike      519:   <p>How user selections of suggestions are handled depends on whether
                    520:   the element is a control accepting a single value only, or whether
                    521:   it accepts multiple values:</p>
                    522: 
                    523:   <dl class="switch"><dt>If the element does not have a <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute specified or
                    524:    if the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute
                    525:    does not apply</dt>
                    526: 
                    527:    <dd>
                    528: 
                    529:     <p>When the user selects a suggestion, the <code><a href="the-input-element.html#the-input-element">input</a></code>
1.67      mike      530:     element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> must be set
                    531:     to the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, as if the user had
1.30      mike      532:     written that value himself.</p>
                    533: 
                    534:    </dd>
                    535: 
                    536:    <dt>If the element <em>does</em> have a <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute specified,
                    537:    and the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute
                    538:    does apply</dt>
                    539: 
                    540:    <dd>
                    541: 
                    542:     <p>When the user selects a suggestion, the user agent must either
1.67      mike      543:     add a new entry to the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a>, whose value is
                    544:     the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, or change an existing
                    545:     entry in the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a> to have the value
                    546:     given by the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, as if the user had
1.30      mike      547:     himself added an entry with that value, or edited an existing
                    548:     entry to be that value. Which behavior is to be applied depends on
                    549:     the user interface in a user-agent-defined manner.</p>
                    550: 
                    551:    </dd>
                    552: 
                    553:   </dl><hr><p>If the <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute does
1.1       mike      554:   not apply, there is no <a href="#concept-input-list" title="concept-input-list">suggestions
                    555:   source element</a>.</p>
                    556: 
1.151     mike      557:   </div>
                    558: 
                    559:   <div class="example">
1.1       mike      560: 
                    561:    <p>This URL field offers some suggestions.</p>
                    562: 
                    563:    <pre>&lt;label&gt;Homepage: &lt;input name=hp type=url list=hpurls&gt;&lt;/label&gt;
                    564: &lt;datalist id=hpurls&gt;
                    565:  &lt;option value="http://www.google.com/" label="Google"&gt;
                    566:  &lt;option value="http://www.reddit.com/" label="Reddit"&gt;
                    567: &lt;/datalist&gt;</pre>
                    568: 
                    569:    <p>Other URLs from the user's history might show also; this is up
                    570:    to the user agent.</p>
                    571: 
1.151     mike      572:   </div>
                    573: 
                    574:   <div class="example">
1.1       mike      575: 
                    576:    <p>This example demonstrates how to design a form that uses the
                    577:    autocompletion list feature while still degrading usefully in
                    578:    legacy user agents.</p>
                    579: 
                    580:    <p>If the autocompletion list is merely an aid, and is not
1.67      mike      581:    important to the content, then simply using a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>
                    582:    element with children <code><a href="the-option-element.html#the-option-element">option</a></code> elements is enough. To
1.1       mike      583:    prevent the values from being rendered in legacy user agents, they
1.67      mike      584:    need to be placed inside the <code title="attr-option-value"><a href="the-option-element.html#attr-option-value">value</a></code> attribute instead of
1.1       mike      585:    inline.</p>
                    586: 
                    587:    <pre>&lt;p&gt;
                    588:  &lt;label&gt;
                    589:   Enter a breed:
                    590:   &lt;input type="text" name="breed" list="breeds"&gt;
                    591:   &lt;datalist id="breeds"&gt;
                    592:    &lt;option value="Abyssinian"&gt;
                    593:    &lt;option value="Alpaca"&gt;
                    594:    &lt;!-- ... --&gt;
                    595:   &lt;/datalist&gt;
                    596:  &lt;/label&gt;
                    597: &lt;/p&gt;</pre>
                    598: 
                    599:    <p>However, if the values need to be shown in legacy UAs, then
1.67      mike      600:    fallback content can be placed inside the <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>
1.1       mike      601:    element, as follows:</p>
                    602: 
                    603:    <pre>&lt;p&gt;
                    604:  &lt;label&gt;
                    605:   Enter a breed:
                    606:   &lt;input type="text" name="breed" list="breeds"&gt;
                    607:  &lt;/label&gt;
                    608:  &lt;datalist id="breeds"&gt;
                    609:   &lt;label&gt;
                    610:    or select one from the list:
                    611:    &lt;select name="breed"&gt;
                    612:     &lt;option value=""&gt; (none selected)
                    613:     &lt;option&gt;Abyssinian
                    614:     &lt;option&gt;Alpaca
                    615:     &lt;!-- ... --&gt;
                    616:    &lt;/select&gt;
                    617:   &lt;/label&gt;
                    618:  &lt;/datalist&gt;
                    619: &lt;/p&gt;
                    620: </pre>
                    621: 
                    622:    <p>The fallback content will only be shown in UAs that don't
1.67      mike      623:    support <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>. The options, on the other hand, will
1.54      mike      624:    be detected by all UAs, even though they are not children of the
1.67      mike      625:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element.</p>
1.1       mike      626: 
1.67      mike      627:    <p>Note that if an <code><a href="the-option-element.html#the-option-element">option</a></code> element used in a
                    628:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> is <code title="attr-option-selected"><a href="the-option-element.html#attr-option-selected">selected</a></code>, it will be selected
1.1       mike      629:    by default by legacy UAs (because it affects the
1.67      mike      630:    <code><a href="the-select-element.html#the-select-element">select</a></code>), but it will not have any effect on the
1.1       mike      631:    <code><a href="the-input-element.html#the-input-element">input</a></code> element in UAs that support
1.67      mike      632:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>.</p>
1.1       mike      633: 
1.151     mike      634:   </div>
                    635: 
                    636: 
                    637: 
                    638:   <h6 id="the-readonly-attribute"><span class="secno">4.10.7.3.4 </span>The <code title="attr-input-readonly"><a href="#attr-input-readonly">readonly</a></code> attribute</h6>
                    639: 
                    640:   <p>The <dfn id="attr-input-readonly" title="attr-input-readonly"><code>readonly</code></dfn>
1.1       mike      641:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that controls whether
1.12      mike      642:   or not the user can edit the form control. <span class="impl">When
1.151     mike      643:   specified, the element is <i title="concept-input-immutable"><a href="the-input-element.html#concept-input-immutable">immutable</a></i>.</span></p>
                    644: 
                    645:   <div class="impl">
1.1       mike      646: 
                    647:   <p><strong>Constraint validation</strong>: If the <code title="attr-input-readonly"><a href="#attr-input-readonly">readonly</a></code> attribute is specified
1.67      mike      648:   on an <code><a href="the-input-element.html#the-input-element">input</a></code> element, the element is <a href="constraints.html#barred-from-constraint-validation">barred from
1.1       mike      649:   constraint validation</a>.</p>
                    650: 
1.151     mike      651:   </div>
                    652: 
                    653:   <div class="example">
1.1       mike      654: 
                    655:    <p>In the following example, the existing product identifiers
                    656:    cannot be modified, but they are still displayed as part of the
                    657:    form, for consistency with the row representing a new product
                    658:    (where the identifier is not yet filled in).</p>
                    659: 
                    660:    <pre>&lt;form action="products.cgi" method=post enctype="multipart/form-data"&gt;
                    661:  &lt;table&gt;
                    662:   &lt;tr&gt; &lt;th&gt; Product ID &lt;th&gt; Product name &lt;th&gt; Price &lt;th&gt; Action
                    663:   &lt;tr&gt;
                    664:    &lt;td&gt; &lt;input readonly name="1.pid" value="H412"&gt;
                    665:    &lt;td&gt; &lt;input required name="1.pname" value="Floor lamp Ulke"&gt;
                    666:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="1.pprice" value="49.99"&gt;
                    667:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:1"&gt;Delete&lt;/button&gt;
                    668:   &lt;tr&gt;
                    669:    &lt;td&gt; &lt;input readonly name="2.pid" value="FG28"&gt;
                    670:    &lt;td&gt; &lt;input required name="2.pname" value="Table lamp Ulke"&gt;
                    671:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="2.pprice" value="24.99"&gt;
                    672:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:2"&gt;Delete&lt;/button&gt;
                    673:   &lt;tr&gt;
                    674:    &lt;td&gt; &lt;input required name="3.pid" value="" pattern="[A-Z0-9]+"&gt;
                    675:    &lt;td&gt; &lt;input required name="3.pname" value=""&gt;
                    676:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="3.pprice" value=""&gt;
                    677:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:3"&gt;Delete&lt;/button&gt;
                    678:  &lt;/table&gt;
                    679:  &lt;p&gt; &lt;button formnovalidate name="action" value="add"&gt;Add&lt;/button&gt; &lt;/p&gt;
                    680:  &lt;p&gt; &lt;button name="action" value="update"&gt;Save&lt;/button&gt; &lt;/p&gt;
                    681: &lt;/form&gt;</pre>
                    682: 
1.151     mike      683:   </div>
                    684: 
                    685: 
                    686: 
                    687:   <h6 id="the-size-attribute"><span class="secno">4.10.7.3.5 </span>The <code title="attr-input-size"><a href="#attr-input-size">size</a></code> attribute</h6>
                    688: 
                    689:   <p>The <dfn id="attr-input-size" title="attr-input-size"><code>size</code></dfn>
1.1       mike      690:   attribute gives the number of characters that, in a visual
                    691:   rendering, the user agent is to allow the user to see while editing
1.151     mike      692:   the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>.</p>
                    693: 
                    694:   <p>The <code title="attr-input-size"><a href="#attr-input-size">size</a></code> attribute, if
1.1       mike      695:   specified, must have a value that is a <a href="common-microsyntaxes.html#valid-non-negative-integer">valid non-negative
1.151     mike      696:   integer</a> greater than zero.</p>
                    697: 
                    698:   <div class="impl">
1.1       mike      699: 
                    700:   <p>If the attribute is present, then its value must be parsed using
                    701:   the <a href="common-microsyntaxes.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative integers</a>, and if the
                    702:   result is a number greater than zero, then the user agent should
                    703:   ensure that at least that many characters are visible.</p>
                    704: 
                    705:   <p>The <code title="dom-input-size"><a href="the-input-element.html#dom-input-size">size</a></code> IDL attribute is
                    706:   <a href="common-dom-interfaces.html#limited-to-only-non-negative-numbers-greater-than-zero">limited to only non-negative numbers greater than
1.17      mike      707:   zero</a> and has a default value of 20.</p>
1.1       mike      708: 
1.151     mike      709:   </div>
                    710: 
                    711: 
                    712: 
                    713:   <h6 id="the-required-attribute"><span class="secno">4.10.7.3.6 </span>The <code title="attr-input-required"><a href="#attr-input-required">required</a></code> attribute</h6>
                    714: 
                    715:   <p>The <dfn id="attr-input-required" title="attr-input-required"><code>required</code></dfn>
1.1       mike      716:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. When specified, the
1.151     mike      717:   element is <dfn id="concept-input-required" title="concept-input-required"><i>required</i></dfn>.</p>
                    718: 
                    719:   <div class="impl">
1.1       mike      720: 
1.67      mike      721:   <p><strong>Constraint validation</strong>: If the element is <i title="concept-input-required"><a href="#concept-input-required">required</a></i>, and its <code title="dom-input-value"><a href="common-input-element-apis.html#dom-input-value">value</a></code> IDL attribute applies and is in
                    722:   the mode <a href="common-input-element-apis.html#dom-input-value-value" title="dom-input-value-value">value</a>, and the
1.1       mike      723:   element is <i title="concept-input-mutable"><a href="the-input-element.html#concept-input-mutable">mutable</a></i>, and the
1.67      mike      724:   element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is the empty
                    725:   string, then the element is <a href="constraints.html#suffering-from-being-missing">suffering from being
1.1       mike      726:   missing</a>.</p>
                    727: 
1.151     mike      728:   </div>
                    729: 
                    730:   <div class="example">
1.1       mike      731: 
                    732:    <p>The following form has two required fields, one for an e-mail
                    733:    address and one for a password. It also has a third field that is
1.119     mike      734:    only considered valid if the user types the same password in the
1.1       mike      735:    password field and this third field.</p>
                    736: 
                    737:    <pre>&lt;h1&gt;Create new account&lt;/h1&gt;
1.33      mike      738: &lt;form action="/newaccount" method=post
                    739:       oninput="up2.setCustomValidity(up2.value != up.value ? 'Passwords do not match.' : '')"&gt;
1.1       mike      740:  &lt;p&gt;
                    741:   &lt;label for="username"&gt;E-mail address:&lt;/label&gt;
                    742:   &lt;input id="username" type=email required name=un&gt;
                    743:  &lt;p&gt;
                    744:   &lt;label for="password1"&gt;Password:&lt;/label&gt;
                    745:   &lt;input id="password1" type=password required name=up&gt;
                    746:  &lt;p&gt;
                    747:   &lt;label for="password2"&gt;Confirm password:&lt;/label&gt;
1.33      mike      748:   &lt;input id="password2" type=password name=up2&gt;
1.1       mike      749:  &lt;p&gt;
                    750:   &lt;input type=submit value="Create account"&gt;
                    751: &lt;/form&gt;</pre>
                    752: 
1.151     mike      753:   </div>
                    754: 
                    755: 
                    756:   <h6 id="the-multiple-attribute"><span class="secno">4.10.7.3.7 </span>The <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute</h6>
                    757: 
                    758:   <p>The <dfn id="attr-input-multiple" title="attr-input-multiple"><code>multiple</code></dfn>
1.1       mike      759:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that indicates whether
1.151     mike      760:   the user is to be allowed to specify more than one value.</p>
                    761: 
                    762:   <div class="example">
1.1       mike      763: 
                    764:    <p>The following extract shows how an e-mail client's "Cc" field
                    765:    could accept multiple e-mail addresses.</p>
                    766: 
                    767:    <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc&gt;&lt;/label&gt;</pre>
                    768: 
                    769:    <p>If the user had, amongst many friends in his user contacts
                    770:    database, two friends "Arthur Dent" (with address
                    771:    "art@example.net") and "Adam Josh" (with address
                    772:    "adamjosh@example.net"), then, after the user has typed "a", the
                    773:    user agent might suggest these two e-mail addresses to the
                    774:    user.</p>
                    775: 
1.47      mike      776:    <p><img alt="" height="140" src="http://dev.w3.org/html5/spec/images/sample-email-1.png" width="500"></p>
1.1       mike      777: 
                    778:    <p>The page could also link in the user's contacts database from the site:</p>
                    779: 
                    780:    <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc list=contacts&gt;&lt;/label&gt;
                    781: ...
                    782: &lt;datalist id="contacts"&gt;
                    783:  &lt;option value="hedral@damowmow.com"&gt;
                    784:  &lt;option value="pillar@example.com"&gt;
                    785:  &lt;option value="astrophy@cute.example"&gt;
                    786:  &lt;option value="astronomy@science.example.org"&gt;
                    787: &lt;/datalist&gt;</pre>
                    788: 
                    789:    <p>Suppose the user had entered "bob@example.net" into this text
                    790:    field, and then started typing a second e-mail address starting
                    791:    with "a". The user agent might show both the two friends mentioned
                    792:    earlier, as well as the "astrophy" and "astronomy" values given in
1.67      mike      793:    the <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element.</p>
1.1       mike      794: 
1.47      mike      795:    <p><img alt="" height="171" src="http://dev.w3.org/html5/spec/images/sample-email-2.png" width="500"></p>
1.1       mike      796: 
1.151     mike      797:   </div>
                    798: 
                    799:   <div class="example">
1.1       mike      800: 
                    801:    <p>The following extract shows how an e-mail client's "Attachments"
                    802:    field could accept multiple files for upload.</p>
                    803: 
                    804:    <pre>&lt;label&gt;Attachments: &lt;input type=file multiple name=att&gt;&lt;/label&gt;</pre>
                    805: 
1.151     mike      806:   </div>
                    807: 
                    808: 
                    809:   <h6 id="the-maxlength-attribute"><span class="secno">4.10.7.3.8 </span>The <code title="attr-input-maxlength"><a href="#attr-input-maxlength">maxlength</a></code> attribute</h6>
                    810: 
                    811:   <p>The <dfn id="attr-input-maxlength" title="attr-input-maxlength"><code>maxlength</code></dfn>
1.67      mike      812:   attribute<span class="impl">, when it applies,</span> is a <a href="attributes-common-to-form-controls.html#attr-fe-maxlength" title="attr-fe-maxlength">form control <code title="">maxlength</code> attribute</a><span class="impl">
1.1       mike      813:   controlled by the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="the-input-element.html#concept-input-value-dirty-flag" title="concept-input-value-dirty-flag">dirty value
1.151     mike      814:   flag</a></span>.</p>
                    815: 
                    816:   <p>If the <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <a href="attributes-common-to-form-controls.html#maximum-allowed-value-length">maximum allowed
1.64      mike      817:   value length</a>, then the <a href="infrastructure.html#code-point-length">code-point length</a> of the
1.1       mike      818:   value of the element's <code title="attr-input-value"><a href="the-input-element.html#attr-input-value">value</a></code>
1.67      mike      819:   attribute must be equal to or less than the element's <a href="attributes-common-to-form-controls.html#maximum-allowed-value-length">maximum
1.151     mike      820:   allowed value length</a>.</p>
                    821: 
                    822:   <div class="example">
1.1       mike      823: 
                    824:    <p>The following extract shows how a messaging client's text entry
                    825:    could be arbitrarily restricted to a fixed number of characters,
1.15      mike      826:    thus forcing any conversation through this medium to be terse and
1.1       mike      827:    discouraging intelligent discourse.</p>
                    828: 
1.59      mike      829:    <pre>&lt;label&gt;What are you doing? &lt;input name=status maxlength=140&gt;&lt;/label&gt;</pre>
1.1       mike      830: 
1.151     mike      831:   </div>
                    832: 
                    833: 
                    834: 
                    835:   <h6 id="the-pattern-attribute"><span class="secno">4.10.7.3.9 </span>The <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute</h6>
                    836: 
                    837:   <p>The <dfn id="attr-input-pattern" title="attr-input-pattern"><code>pattern</code></dfn>
1.1       mike      838:   attribute specifies a regular expression against which the control's
1.67      mike      839:   <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, or, when the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute applies and is
                    840:   set, the control's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a>, are to be
1.151     mike      841:   checked.</p>
                    842: 
                    843:   <p>If specified, the attribute's value must match the JavaScript <i title="">Pattern</i> production. <a href="references.html#refsECMA262">[ECMA262]</a></p>
                    844: 
                    845:   <div class="impl">
1.30      mike      846: 
                    847:   <p>If an <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute specified, and
                    848:   the attribute's value, when compiled as a JavaScript regular
                    849:   expression with the <code title="">global</code>, <code title="">ignoreCase</code>, and <code title="">multiline</code>
                    850:   flags <em>disabled</em> (see ECMA262 Edition 5, sections 15.10.7.2
                    851:   through 15.10.7.4), compiles successfully, then the resulting
                    852:   regular expression is the element's <dfn id="compiled-pattern-regular-expression">compiled pattern regular
                    853:   expression</dfn>. If the element has no such attribute, or if the
                    854:   value doesn't compile successfully, then the element has no
1.58      mike      855:   <a href="#compiled-pattern-regular-expression">compiled pattern regular expression</a>. <a href="references.html#refsECMA262">[ECMA262]</a></p>
1.1       mike      856: 
1.67      mike      857:   <p><strong>Constraint validation</strong>: If the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is not the empty string, and
1.30      mike      858:   either the element's <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute is not
                    859:   specified or it does not apply to the <code><a href="the-input-element.html#the-input-element">input</a></code> element
                    860:   given its <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's
                    861:   current state, and the element has a <a href="#compiled-pattern-regular-expression">compiled pattern regular
                    862:   expression</a> but that regular expression does not match the
1.67      mike      863:   entirety of the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, then the element is
                    864:   <a href="constraints.html#suffering-from-a-pattern-mismatch">suffering from a pattern mismatch</a>.</p>
1.30      mike      865: 
1.67      mike      866:   <p><strong>Constraint validation</strong>: If the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is not the empty string, and
1.30      mike      867:   the element's <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code>
                    868:   attribute is specified and applies to the <code><a href="the-input-element.html#the-input-element">input</a></code>
                    869:   element, and the element has a <a href="#compiled-pattern-regular-expression">compiled pattern regular
                    870:   expression</a> but that regular expression does not match the
1.67      mike      871:   entirety of each of the element's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a>, then the element
                    872:   is <a href="constraints.html#suffering-from-a-pattern-mismatch">suffering from a pattern mismatch</a>.</p>
1.1       mike      873: 
1.50      mike      874:   <p>The <a href="#compiled-pattern-regular-expression">compiled pattern regular expression</a>, when
                    875:   matched against a string, must have its start anchored to the start
                    876:   of the string and its end anchored to the end of the string.</p>
                    877: 
1.1       mike      878:   <p class="note">This implies that the regular expression language
                    879:   used for this attribute is the same as that used in JavaScript,
                    880:   except that the <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code>
1.50      mike      881:   attribute is matched against the entire value, not just any subset
                    882:   (somewhat as if it implied a <code title="">^(?:</code> at the start
                    883:   of the pattern and a <code title="">)$</code> at the end).</p>
1.1       mike      884: 
1.151     mike      885:   </div>
                    886: 
                    887:   <p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute specified,
1.67      mike      888:   authors should include a <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code>
1.1       mike      889:   attribute to give a description of the pattern. User agents may use
                    890:   the contents of this attribute, if it is present, when informing the
                    891:   user that the pattern is not matched, or at any other suitable time,
                    892:   such as in a tooltip or read out by assistive technology when the
1.151     mike      893:   control gains focus.</p>
                    894: 
                    895:   <div class="example">
1.1       mike      896:    <p>For example, the following snippet:</p>
                    897:    <pre>&lt;label&gt; Part number:
                    898:  &lt;input pattern="[0-9][A-Z]{3}" name="part"
                    899:         title="A part number is a digit followed by three uppercase letters."/&gt;
                    900: &lt;/label&gt;</pre>
                    901:    <p>...could cause the UA to display an alert such as:</p>
                    902:    <pre><samp>A part number is a digit followed by three uppercase letters.
1.11      mike      903: You cannot submit this form when the field is incorrect.</samp></pre>
1.151     mike      904:   </div>
                    905: 
                    906:   <p>When a control has a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute, the <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code> attribute, if used, must describe
1.1       mike      907:   the pattern.  Additional information could also be included, so long
                    908:   as it assists the user in filling in the control. Otherwise,
1.151     mike      909:   assistive technology would be impaired.</p>
                    910: 
                    911:   <p class="example">For instance, if the title attribute contained
1.1       mike      912:   the caption of the control, assistive technology could end up saying
                    913:   something like <samp>The text you have entered does not match the
1.151     mike      914:   required pattern. Birthday</samp>, which is not useful.</p>
                    915: 
                    916:   <p>UAs may still show the <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code> in
1.101     mike      917:   non-error situations (for example, as a tooltip when hovering over
                    918:   the control), so authors should be careful not to word <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code>s as if an error has necessarily
1.151     mike      919:   occurred.</p>
                    920: 
                    921: 
                    922: 
                    923:   <h6 id="the-min-and-max-attributes"><span class="secno">4.10.7.3.10 </span>The <code title="attr-input-min"><a href="#attr-input-min">min</a></code> and <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attributes</h6>
                    924: 
                    925:   <p>The <dfn id="attr-input-min" title="attr-input-min"><code>min</code></dfn> and <dfn id="attr-input-max" title="attr-input-max"><code>max</code></dfn> attributes indicate
                    926:   the allowed range of values for the element.</p>
                    927: 
                    928:   <div class="impl">
1.1       mike      929: 
                    930:   <p>Their syntax is defined by the section that defines the <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state.</p>
                    931: 
                    932:   <p>If the element has a <code title="attr-input-min"><a href="#attr-input-min">min</a></code>
                    933:   attribute, and the result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
                    934:   string to a number</a> to the value of the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute is a number, then that
                    935:   number is the element's <dfn id="concept-input-min" title="concept-input-min">minimum</dfn>; otherwise, if the <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                    936:   defines a <dfn id="concept-input-min-default" title="concept-input-min-default">default
                    937:   minimum</dfn>, then that is the <a href="#concept-input-min" title="concept-input-min">minimum</a>; otherwise, the element has
                    938:   no <a href="#concept-input-min" title="concept-input-min">minimum</a>.</p>
                    939: 
                    940:   <p><strong>Constraint validation</strong>: When the element has a
                    941:   <a href="#attr-input-min" title="attr-input-min">minimum</a>, and the result of
                    942:   applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
1.67      mike      943:   string to a number</a> to the string given by the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is a number, and the number
1.1       mike      944:   obtained from that algorithm is less than the <a href="#attr-input-min" title="attr-input-min">minimum</a>, the element is
1.67      mike      945:   <a href="constraints.html#suffering-from-an-underflow">suffering from an underflow</a>.</p>
1.1       mike      946: 
                    947:   <p>The <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute also
                    948:   defines the <a href="#concept-input-min-zero" title="concept-input-min-zero">step
                    949:   base</a>.</p>
                    950: 
                    951:   <p>If the element has a <code title="attr-input-max"><a href="#attr-input-max">max</a></code>
                    952:   attribute, and the result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
                    953:   string to a number</a> to the value of the <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attribute is a number, then that
                    954:   number is the element's <dfn id="concept-input-max" title="concept-input-max">maximum</dfn>; otherwise, if the <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                    955:   defines a <dfn id="concept-input-max-default" title="concept-input-max-default">default
                    956:   maximum</dfn>, then that is the <a href="#concept-input-max" title="concept-input-max">maximum</a>; otherwise, the element has
                    957:   no <a href="#concept-input-max" title="concept-input-max">maximum</a>.</p>
                    958: 
                    959:   <p><strong>Constraint validation</strong>: When the element has a
                    960:   <a href="#attr-input-max" title="attr-input-max">maximum</a>, and the result of
                    961:   applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
1.67      mike      962:   string to a number</a> to the string given by the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is a number, and the number
1.1       mike      963:   obtained from that algorithm is more than the <a href="#attr-input-max" title="attr-input-max">maximum</a>, the element is
1.67      mike      964:   <a href="constraints.html#suffering-from-an-overflow">suffering from an overflow</a>.</p>
1.1       mike      965: 
1.151     mike      966:   </div>
                    967: 
                    968:   <p>The <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attribute's value
1.1       mike      969:   (the <a href="#concept-input-max" title="concept-input-max">maximum</a>) must not be
                    970:   less than the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute's
1.151     mike      971:   value (its <a href="#concept-input-min" title="concept-input-min">minimum</a>).</p>
                    972: 
                    973:   <div class="impl">
1.1       mike      974: 
                    975:   <p class="note">If an element has a <a href="#attr-input-max" title="attr-input-max">maximum</a> that is less than its <a href="#attr-input-min" title="attr-input-min">minimum</a>, then so long as the element
1.67      mike      976:   has a <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, it will either be
                    977:   <a href="constraints.html#suffering-from-an-underflow">suffering from an underflow</a> or <a href="constraints.html#suffering-from-an-overflow">suffering from an
1.1       mike      978:   overflow</a>.</p>
                    979: 
1.151     mike      980:   </div>
                    981: 
                    982:   <p>An element <dfn id="have-range-limitations" title="have range limitations">has range
                    983:   limitations</dfn> if it has a defined <a href="#concept-input-min" title="concept-input-min">minimum</a> or a defined <a href="#concept-input-max" title="concept-input-max">maximum</a>.</p>
                    984: 
                    985:   <div class="example">
1.1       mike      986: 
                    987:    <p>The following date control limits input to dates that are before
                    988:    the 1980s:</p>
                    989: 
                    990:    <pre>&lt;input name=bday type=date max="1979-12-31"&gt;</pre>
                    991: 
1.151     mike      992:   </div>
                    993: 
                    994:   <div class="example">
1.1       mike      995: 
                    996:    <p>The following number control limits input to whole numbers
                    997:    greater than zero:</p>
                    998: 
                    999:    <pre>&lt;input name=quantity required type=number min=1 value=1&gt;</pre>
                   1000: 
1.151     mike     1001:   </div>
                   1002: 
                   1003: 
                   1004:   <h6 id="the-step-attribute"><span class="secno">4.10.7.3.11 </span>The <code title="attr-input-step"><a href="#attr-input-step">step</a></code> attribute</h6>
                   1005: 
                   1006:   <p>The <dfn id="attr-input-step" title="attr-input-step"><code>step</code></dfn>
1.1       mike     1007:   attribute indicates the granularity that is expected (and required)
1.67      mike     1008:   of the <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, by limiting the
1.1       mike     1009:   allowed values. <span class="impl">The section that defines the
                   1010:   <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                   1011:   also defines the <dfn id="concept-input-step-default" title="concept-input-step-default">default
                   1012:   step</dfn>, the <dfn id="concept-input-step-scale" title="concept-input-step-scale">step scale
                   1013:   factor</dfn>, and in some cases the <dfn id="concept-input-step-default-base" title="concept-input-step-default-base">default step base</dfn>,
                   1014:   which are used in processing the attribute as described
1.151     mike     1015:   below.</span></p>
                   1016: 
                   1017:   <p>The <code title="attr-input-step"><a href="#attr-input-step">step</a></code> attribute, if
1.1       mike     1018:   specified, must either have a value that is a <a href="common-microsyntaxes.html#valid-floating-point-number">valid floating
                   1019:   point number</a> that <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values" title="rules for parsing floating
                   1020:   point number values">parses</a> to a number that is greater than
                   1021:   zero, or must have a value that is an <a href="infrastructure.html#ascii-case-insensitive">ASCII
1.151     mike     1022:   case-insensitive</a> match for the string "<code title="">any</code>".</p>
                   1023: 
                   1024:   <div class="impl">
1.1       mike     1025: 
                   1026:   <p>The attribute provides the <dfn id="concept-input-step" title="concept-input-step">allowed value step</dfn> for the element,
                   1027:   as follows:</p>
                   1028: 
                   1029:   <ol><li>If the attribute is absent, then the <a href="#concept-input-step" title="concept-input-step">allowed value step</a> is the <a href="#concept-input-step-default" title="concept-input-step-default">default step</a> multiplied
                   1030:    by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale
                   1031:    factor</a>.</li>
                   1032: 
                   1033:    <li>Otherwise, if the attribute's value is an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1034:    case-insensitive</a> match for the string "<code title="">any</code>", then there is no <a href="#concept-input-step" title="concept-input-step">allowed value step</a>.</li>
                   1035: 
                   1036:    <li>Otherwise, if the <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values">rules for parsing floating point number
                   1037:    values</a>, when they are applied to the attribute's value,
                   1038:    return an error, zero, or a number less than zero, then the <a href="#concept-input-step" title="concept-input-step">allowed value step</a> is the <a href="#concept-input-step-default" title="concept-input-step-default">default step</a> multiplied
                   1039:    by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale
                   1040:    factor</a>.</li>
                   1041: 
                   1042:    <li>Otherwise, the <a href="#concept-input-step" title="concept-input-step">allowed value
                   1043:    step</a> is the number returned by the <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values">rules for parsing
                   1044:    floating point number values</a> when they are applied to the
                   1045:    attribute's value, multiplied by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale factor</a>.</li>
                   1046: 
                   1047:   </ol><p>The <dfn id="concept-input-min-zero" title="concept-input-min-zero">step base</dfn> is the
                   1048:   result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
                   1049:   string to a number</a> to the value of the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute, unless the element does
                   1050:   not have a <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute
                   1051:   specified or the result of applying that algorithm is an error, in
                   1052:   which case the <a href="#concept-input-min-zero" title="concept-input-min-zero">step base</a>
                   1053:   is the <a href="#concept-input-step-default-base" title="concept-input-step-default-base">default step
                   1054:   base</a>, if one is defined, or zero, if not.</p>
                   1055: 
                   1056:   <p><strong>Constraint validation</strong>: When the element has an
                   1057:   <a href="#concept-input-step" title="concept-input-step">allowed value step</a>, and the
                   1058:   result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
1.67      mike     1059:   string to a number</a> to the string given by the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is a number, and that
1.1       mike     1060:   number subtracted from the <a href="#concept-input-min-zero" title="concept-input-min-zero">step
                   1061:   base</a> is not an integral multiple of the <a href="#concept-input-step" title="concept-input-step">allowed value step</a>, the element is
1.67      mike     1062:   <a href="constraints.html#suffering-from-a-step-mismatch">suffering from a step mismatch</a>.</p>
1.1       mike     1063: 
1.151     mike     1064:   </div>
                   1065: 
                   1066:   <div class="example">
1.1       mike     1067: 
                   1068:    <p>The following range control only accepts values in the range
                   1069:    0..1, and allows 256 steps in that range:</p>
                   1070: 
                   1071:    <pre>&lt;input name=opacity type=range min=0 max=1 step=0.00392156863&gt;</pre>
                   1072: 
1.151     mike     1073:   </div>
                   1074: 
                   1075:   <div class="example">
1.1       mike     1076: 
                   1077:    <p>The following control allows any time in the day to be selected,
                   1078:    with any accuracy (e.g. thousandth-of-a-second accuracy or
                   1079:    more):</p>
                   1080: 
                   1081:    <pre>&lt;input name=favtime type=time step=any&gt;</pre>
                   1082: 
                   1083:    <p>Normally, time controls are limited to an accuracy of one
                   1084:    minute.</p>
                   1085: 
1.151     mike     1086:   </div>
                   1087: 
                   1088: 
                   1089: 
                   1090: 
                   1091:   <h6 id="the-placeholder-attribute"><span class="secno">4.10.7.3.12 </span>The <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code> attribute</h6>
                   1092: 
                   1093:   
                   1094: 
                   1095:   <p>The <dfn id="attr-input-placeholder" title="attr-input-placeholder"><code>placeholder</code></dfn>
1.1       mike     1096:   attribute represents a <em>short</em> hint (a word or short phrase)
                   1097:   intended to aid the user with data entry. A hint could be a sample
                   1098:   value or a brief description of the expected format. The attribute,
1.151     mike     1099:   if specified, must have a value that contains no "LF" (U+000A) or "CR" (U+000D) characters.</p>
                   1100: 
                   1101:   <p class="note">For a longer hint or other advisory text, the <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code> attribute is more appropriate.</p>
                   1102: 
                   1103:   <p>The <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code>
1.1       mike     1104:   attribute should not be used as an alternative to a
1.151     mike     1105:   <code><a href="the-label-element.html#the-label-element">label</a></code>.</p>
                   1106: 
                   1107:   <div class="impl">
1.1       mike     1108: 
                   1109:   <p>User agents should present this hint to the user, after having
                   1110:   <a href="common-microsyntaxes.html#strip-line-breaks" title="strip line breaks">stripped line breaks</a> from it,
1.67      mike     1111:   when the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is
1.66      mike     1112:   the empty string and/or the control is not focused (e.g. by
                   1113:   displaying it inside a blank unfocused control and hiding it
                   1114:   otherwise).</p>
1.1       mike     1115: 
1.151     mike     1116:   </div>
                   1117: 
                   1118:   <div class="example">
1.1       mike     1119: 
                   1120:    <p>Here is an example of a mail configuration user interface that
                   1121:    uses the <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code>
                   1122:    attribute:</p>
                   1123: 
                   1124:    <pre>&lt;fieldset&gt;
                   1125:  &lt;legend&gt;Mail Account&lt;/legend&gt;
                   1126:  &lt;p&gt;&lt;label&gt;Name: &lt;input type="text" name="fullname" placeholder="John Ratzenberger"&gt;&lt;/label&gt;&lt;/p&gt;
                   1127:  &lt;p&gt;&lt;label&gt;Address: &lt;input type="email" name="address" placeholder="john@example.net"&gt;&lt;/label&gt;&lt;/p&gt;
                   1128:  &lt;p&gt;&lt;label&gt;Password: &lt;input type="password" name="password"&gt;&lt;/label&gt;&lt;/p&gt;
                   1129:  &lt;p&gt;&lt;label&gt;Description: &lt;input type="text" name="desc" placeholder="My Email Account"&gt;&lt;/label&gt;&lt;/p&gt;
                   1130: &lt;/fieldset&gt;</pre>
                   1131: 
1.151     mike     1132:   </div>
                   1133: 
                   1134: 
                   1135: 
                   1136: 
                   1137:   </body></html>

Webmaster