user3213561
user3213561

Reputation: 369

adding html id to form_tag rails 4

I currently have this sign in form in a rails 4 app in which I use the form_tag helper. I'm need to add an id. I tried using <%= form_tag( :html => {:id => 'login_form'} ) do %> but I get an error.

    <%= form_tag do %>
    <div class="form-group">
      <%= label_tag :name, 'Username:', class: "control-label" %>
      <div class="controls">
        <%= text_field_tag :name, params[:name], class: "form-control", size: "30", tabindex: "1" %>
      </div>
    </div>
    <div class="form-group">
      <%= label_tag :password, 'Password:' %>
      <div class="controls">
        <%= password_field_tag :password, params[:password], class: "form-control", size: "30", tabindex: "2" %>
      </div>
    </div>
    <div class="form-group">
      <div class="controls">
        <%= submit_tag "Sign in", class:"btn btn-large", tabindex: "2" %>
      </div>
    </div>
    <% end %>

Upvotes: 1

Views: 1548

Answers (1)

user3213561
user3213561

Reputation: 369

<%= form_tag('/login', id: "login-form") do %>

Upvotes: 5

Related Questions