I think this is a good idea but is not so flexible. If I am reading
this correctly, this will produce

<label for="foo">Foo</label><input type="submit" name="foo /><br/>

This is nice for the very simplest cases and I'd like to see that in
the core but what about when I want to do just a little more.

This is why I don't want to see it in core.  Everyone has their own
little way of doing forms.  I did hack up a little plugin for this:
http://svn.techno-weenie.net/projects/plugins/labeled_form_helper/ as
more of a proof of concept than anything.  It just shows how you might
go about making your own labeled form helper, letting you set up your
simple forms like so:

<%= f.text_field :name %>
<%= f.text_field :age %>

etc...


I think this

<%= f.label :name %>

would be a nice addition to the core also. I've been wanting this for
a long time. The label can also be nicely wrapped in <span
class="labelWithError"> and hiding this can be set individually like
the input elements.

The only reason I don't submit a patch is I don't know if I've got it
right and I don't know if the higher-ups would be receptive.

Peter

I personally rarely use a plain label helper.  It's usually less to
type out than the actual label field.  My plugin from above implements
that as <%= f.label_for :name %>.


--
Rick Olson
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to