{"id":19,"date":"2007-12-31T08:26:23","date_gmt":"2007-12-31T12:26:23","guid":{"rendered":"http:\/\/www.jfciii.com\/blog\/2007\/12\/31\/use-of-ul-or-ol-in-html-forms\/"},"modified":"2012-08-25T13:35:07","modified_gmt":"2012-08-25T17:35:07","slug":"use-of-ul-or-ol-in-html-forms","status":"publish","type":"post","link":"http:\/\/www.jfciii.com\/blog\/2007\/12\/31\/use-of-ul-or-ol-in-html-forms\/","title":{"rendered":"Use of UL or OL in HTML Forms"},"content":{"rendered":"<p>I just finished re-reading Roger Johansson&#8217;s wonderful article entitled &#8220;<a title=\"Roger Johansson article about using lable element in yout HTML to maeformsmore accessible\" href=\"http:\/\/www.456bereastreet.com\/archive\/200711\/use_the_label_element_to_make_your_html_forms_accessible\/\">Use the label element to make your HTML forms accessible<\/a>&#8220;.<\/p>\n<p>I agree with everything he said, except I think by putting the label and the input elements as part of an un-ordered list (UL) or an ordered list (OL) the screen reader will announce how many items are in the list. By doing so you can then place an UL or OL inside a FIELDSET, which will inform you of how many fields you need to be filled in. This number might be greater than the actual number of items if you have lines of text in the middle of the form field list.<\/p>\n<p>I found this great piece of information about using UL or OL in forms from <a title=\"Justin Stockton - Poor Geek or Silicon Soul\" href=\"http:\/\/blog.siliconsoul.org\/\">Justin Stockton<\/a> when he was looking over a form I was building. He either asked &#8220;Why I was using the &lt;BR&gt; tag?&#8221; or &#8220;Why I had form elements inside of a &lt;P&gt; tag&#8221;. I told him that was how I learned to create my forms from articles I had read. He suggested using the UL or the OL for form items. After that, by like only a day or so I was listening to either one of <a title=\"Derek Featherstone's profile o the Web Standards Project which lists his blog and work website\" href=\"http:\/\/www.webstandards.org\/about\/members\/feather\/\">Derek Featherstone<\/a>, <a title=\"Aaron Gustafson's profile on the Web Standards Project wich list a few different websites\" href=\"http:\/\/www.webstandards.org\/about\/members\/agustafson\/\">Aaron Gustafson<\/a>, or boths podcasts about accessibile forms and they mentioned the same thing.<\/p>\n<p>Here is a short\u00a0 code example for filling out personal information on a form:<\/p>\n<p>&lt;fieldset&gt;<br \/>\n&lt;legend&gt;Personal Information&lt;\/legend&gt;<br \/>\n&lt;ul&gt;<br \/>\n&lt;li&gt;<br \/>\n&lt;label for=&#8221;first_name&#8221;&gt;First Name&lt;\/label&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;first_name&#8221; id=&#8221;first_name&#8221; \/&gt;<br \/>\n&lt;\/li&gt;<br \/>\n&lt;li&gt;<br \/>\n&lt;label for=&#8221;last_name&#8221;&gt;Last Name&lt;\/label&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;last_name&#8221; id=&#8221;last_name&#8221; \/&gt;<br \/>\n&lt;\/li&gt;<br \/>\n&lt;li&gt;<br \/>\n&lt;label for=&#8221;company&#8221;&gt;Company&lt;\/label&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;company&#8221; id=&#8221;company&#8221; \/&gt;<br \/>\n&lt;\/li&gt;<br \/>\n&lt;li&gt;<br \/>\n&lt;label for=&#8221;title&#8221;&gt;Title&lt;\/label&gt;<br \/>\n&lt;input type=&#8221;text&#8221; name=&#8221;title&#8221; id=&#8221;title&#8221; \/&gt;<br \/>\n&lt;\/li&gt;<br \/>\n&lt;\/ul&gt;<br \/>\n&lt;\/fieldset&gt;<\/p>\n<p>Now here is what the code looks like as a form:<\/p>\n<fieldset>\n<legend>Personal Information<\/legend>\n<ul>\n<li><label>First Name<\/label><br \/>\n<input id=\"first_name\" type=\"text\" name=\"first_name\" \/><\/li>\n<li><label>Last Name<\/label><br \/>\n<input id=\"last_name\" type=\"text\" name=\"last_name\" \/><\/li>\n<li><label>Company<\/label><br \/>\n<input id=\"company\" type=\"text\" name=\"company\" \/><\/li>\n<li><label>Title<\/label><br \/>\n<input id=\"title\" type=\"text\" name=\"title\" \/><\/li>\n<\/ul>\n<\/fieldset>\n<p>Of course you will need to use a bit of CSS to make this look better. You can remove such things as the fieldset border and do a bunch of other things to it. Here is the same <a title=\"example of form with an ordered list\" href=\"http:\/\/jfciii.com\/formorderedlist.shtml\">example with CSS added<\/a>, nothing fancy. When you use UL or OL in the fieldset you will be improving the accessibility of the form in my opinion.Please give me your thoughts on this matter of using UL or OL inside a fieldset.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I just finished re-reading Roger Johansson&#8217;s wonderful article entitled &#8220;Use the label element to make your HTML forms accessible&#8220;. I agree with everything he said, except I think by putting the label and the input elements as part of an &hellip; <a href=\"http:\/\/www.jfciii.com\/blog\/2007\/12\/31\/use-of-ul-or-ol-in-html-forms\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,23,21,24,44,32,27,20],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-22","category-accessibility","category-css","category-forms","category-helpful-tips","category-layout","category-programming","category-web-standards"],"_links":{"self":[{"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":3,"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":219,"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/posts\/19\/revisions\/219"}],"wp:attachment":[{"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jfciii.com\/blog\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}