Formhelper & label produces incorrect output?

I’m looking at

\InstantRails-2.0-win\ruby\lib\ruby\gems\1.8\gems\actionpack-2.3.5\lib\action_view\helpers\form_helper.rb

at line 509. The comment reads:

  #   label(:post, :title, "A short title")
  #   # => <label for="post_title">A short title</label>

When I pass
A short title
through an HTML validator (e.g. http://validator.w3.org/check )… the
message I get is


value of attribute “for” must be a single token

This attribute can not take a space-separated list of words as a value,
but only one word (“token”). This may also be caused by the use of a
space for the value of an attribute which does not permit it.


What I think the validator is looking for is this
A short title
instead of
A short title

Am I interpreting this correctly?

On Feb 26, 2:24 am, Ralph S. [email protected] wrote:

  <label for="post_title">A short title</label>

What I think the validator is looking for is this
A short title
instead of
A short title

Am I interpreting this correctly?

No, I think you’ve somehow confused the validator. I was able to get
the error message you described, but only by changing the underscore
to a space. The version without attributes is also very wrong if
you’re using an XHMTML doctype.

–Matt J.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs