The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Label me, please!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Stewart

Posts: 72
Nickname: estewart
Registered: Dec, 2003

Eric Stewart is software developer from Austin, Texas.
Label me, please! Posted: Jan 19, 2006 1:34 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Stewart.
Original Post: Label me, please!
Feed Title: Ponderings On Ruby
Feed URL: http://blog.eric-stewart.com/category/programming-ruby.rss
Feed Description: This is the Ruby related section of Eric Stewart's weblog. These entries will be the commentary of a long time Java/C++ programmer that started exploring Ruby in 2003.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Stewart
Latest Posts From Ponderings On Ruby

Advertisement

Imagine you are a good web developer. You like following standards, paying attention to usability, and thinking about accessibility while implementing the latest, greatest whiz-bang next-generation web wunder-site. Yes, I’m talking to you!

You have forms somewhere on your site, right. There has to be one somewhere. And you have labels on all of your fields too, right? Of course you do!

Well, label helpers are one of the things left out of Rails up to and including 1.0. It’s easy to imagine why. A label is pretty trivial to write, and if you can’t figure out the necessary for attribute, then all hope is lost. However you’d love to not have to worry about the for wouldn’t you?

Still, there really needed to be some other reason to go to all the trouble to write a form helper. Well, I can think of one. And so I did.

label_helpers plugin for Rails

This plugin adds the helpers label and label_tag. Of course, label_tag is quite trivial, so it’s label that you’ll see the most benefit from.

I happen to work on web sites often where accessibility is of high priority, and so anything I can to do further that effort is a plus. I happened to like the technique described by Derek Feathersone for form error messages.

In a nutshell, this technique and the new helper allow including error messages for validation problems within the label for an inputs. This allows the error message to be grouped with the field title, aiding screen readers as well as visual users. And CSS can be used to position the error portion of the label appropriately.

Of course you can turn the errors off if need be.

It’s still rough around the edges, but working for me so far. Comments are appreciated!

See the README for usage information.

Installing

Check out the source from Subversion, or preferable use Rails own script/plugin script to help install it. All you have to do (from the root of your rails project) is:

script/plugin source http://www.eric-stewart.com/svn/rails/plugins/
script/plugin install label_helpers

Or, for those that want to do a straight subversion checkout:

svn co http://www.eric-stewart.com/svn/rails/plugins/label_helpers/

Technorati Tags: , ,

Read: Label me, please!

Topic: Problem with RSS categories Previous Topic   Next Topic Topic: So, I’m learning RubyOnRails

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use