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

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

Webmaster