First time visitor? The tutorials start here.

Accessible Forms

<input> (continued)

In my previous examples, I’ve already shown you a text box and a submit button:

<input type="text" id="name" size="20" /><br />
<input type="submit" value="Submit" />

As you can see, the “type” attribute specifies what type of form element you are creating.

Other types used for <input> tags are:

  • password
  • checkbox
  • radio
  • reset
  • file
  • hidden
  • button

Just as textareas need a width and height defined in the tag; <input> tags with a type of text, password, or file all need a length defined, as well. But instead of using the cols attribute, you need to use size.

password — This creates a text box, where characters typed will show up as asterisks or big dots, depending on the browser. This way, anyone looking over the user’s shoulder won’t be able to see what they’re typing in.

Result:

checkbox — When you use checkboxes, people can choose multiple entries.

See it in use:

What kind of fruit do you like?

radio

With radio buttons, people are only allowed one choice.

See it in use:

Which fruit do you like better?

reset — This resets all of the fields in the form to their original values.

To see it in use, type in some values and then click on “Reset”.

file — Allows users to upload a file to your site.

hidden — These don’t appear on the page, and are used to pass hidden variables.

button — Don’t even bother with this one, since it’s only used for javascript events. Many assistive technologies for the disabled can’t process javascript, so it should only be used to enhance your site, and should never be a requirement for using your site.

Layout: Order is important!

Make sure people aren’t entering their phone number instead of their name, or choosing apples when they’re trying to choose oranges. On the third and final page of this tutorial, I’ll teach you how to order things properly.

Please go to the last page to continue. It’s very short, I promise.

This post has multiple pages. Go to page: 1 2 3

If you found this article useful, please spread the word:
Stumble it! Digg! Tweet it!



Comments (7)

jadegreenSeptember 24th, 2010 at 12:48 pm

Great post! Thanks for sharing!

LesaSeptember 24th, 2010 at 2:07 pm

You’re welcome, jadegreen. Thank you for your comment. :)

bchitalaJanuary 11th, 2011 at 12:54 am

Hi Lesa,
I want to know what coding is involved if you just want a portion of a story to be read on one page and the remainder of the paragraphs to be read on another page (i.e. “Read More…”). Do you have to create a new page and how do you link it up with the main page since it’s not on the main navigation link? Could you please give me an example of both the HTML and CSS codes to use. This Much appreciated.

bchitalaJanuary 17th, 2011 at 11:28 pm

CAn anyone advise what code I can implement if I want my web siteto be able to truncate paragraph or news items and direct the reader to “Read more…” Also how can I code to “Archive” new/stories? Any help wil be appreciated. Thanks all.

LesaJanuary 18th, 2011 at 4:28 pm

Sorry I missed your question before, bchitala.

Are you using WordPress? WordPress does this automatically.

bchitalaJanuary 31st, 2011 at 11:59 pm

Hi Lesa. No I’m not using WordPress. I have never tried WordPress at all. I’m just learning how to design a website from scratch. Right now I’m doing a lot of reading but can’t figure out how truncating stories is coded. thanks for getting back to me.

LesaFebruary 1st, 2011 at 12:30 pm

You’re welcome, bchitala. Sorry it took me a few days to know you had posted.

What you’re describing is done with a content management system (CMS) that uses server-side programming and a database, which WordPress will easily manage for you. While I do have one PHP tutorial here and plan to add more in the future, building a proper CMS from scratch is far more extensive than including a few files or creating a mail form, and requires extensive knowledge of 4 different languages: PHP, MySQL, (x)HTML, and CSS.

Questions or comments?

Please log in to post a comment. Sorry, but it prevents this from happening. If you're not registered yet, you can register here.