Forum: Ruby on Rails css selectors and ActionView::FormHelper

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
James B. (Guest)
on 2009-02-26 23:57
Rails 2.2.2

In a view partial, When I do this:

      <%= label client_detail.class.to_s.downcase,
                :client_credit_limit,
                "Credit Limit: ",
                :class => :input_box_label,
                :for => 'input_client_credit_limit
      -%>

      <%= ff.text_field  :client_credit_limit,
            :id => 'input_client_credit_limit',
            :size => 12,
            :value => client_detail.client_credit_limit
      -%>
    </p>

Then I see this:

      <label class="input_box_label"
         for="input_client_credit_limit">
         Credit Limit:
      </label>

      <input
         id="input_client_credit_limit"
         name="client[client_credit_limit]"
         size="12" type="text" value="0" />

But, when I do this:

    <%= label :client,
              :client_credit_policy,
              "Credit Policy",
              :class => :input_box_label
    -%>

    <%= ff.select :client_credit_policy,
              [ ['CASH - Advance Billing', 'CASH'],
                ['OPEN - Open Account', 'OPEN'],
              ],
              :prompt => 'Select Credit Policy Code',
              :size => 4
    -%>

Then I see this:

    <label
      class="input_box_label"
      for="select_client_credit_policy">
      Credit Policy
    </label>

    <select
       id="client_client_credit_policy"
       name="client[client_credit_policy]">
       <option value="CASH" selected="selected">
          CASH - Advance Billing</option>
       <option value="OPEN">
          OPEN - Open Account</option>
    </select>

Select does not honour the :id => 'text' option when provided. Instead
it creates an id of the form <model>_<attribute>.  However, text_field
does honour the :id => 'text' option if given.

Is this a bug?
This topic is locked and can not be replied to.