Forum: Ruby on Rails Label Helpers

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Fd4f7add4445007baedc5d84f9e67ca2?d=identicon&s=25 Ross Riley (Guest)
on 2006-06-07 16:07
(Received via mailing list)
Don't know whether this has been discussed for the core, or if anyone
has seen a plugin.
Can anyone think of a reason why the form helpers don't produce
corresponding labels?
Take the following example....

<label for="hotel_content_airportlocal" class="inputLabel">Name of
Local airport</label>
<%= text_field 'hotel_content', 'airportlocal'%>

The helper for text_field is compact but the necessary label code is
twice as long when most of the information is specific for the field.

Surely a syntax such as....
<%= text_field 'hotel_content', 'airportlocal', :label => "Name of
local airport"%>

would be much more DRY. You could always pass false to :label to omit

Any thoughts?
Db303dc84d03a992b33cd3ac978f89ae?d=identicon&s=25 Benjamin Curtis (Guest)
on 2006-06-07 16:27
(Received via mailing list) :)

Benjamin Curtis -- Collaborative test case management -- Resources for the Rails community
This topic is locked and can not be replied to.