Translate form classes and ids to rails form_tag fields -


i have bootstrap theme i'm using. in theme applying styles through css selectors, through html form. want transfer attributes on form_tag styling remains intact css.

<form name="sentmessage"  novalidate="">    <p>your e-mail</p>   <input type="text" class="form-control" id="email" required="" data-validation-required-message="enter email">    <p>your password</p>   <input type="email" class="form-control" id="password" required="" data-validation-required-message="enter password">    <button type="submit" class="btn btn-default pull-right send">log in</button> 

i'd apply same styles on rails form_tag, having little trouble doing so:

<% if @user.errors.any? %> <ul>   <% @user.errors.full_messages.each |error| %>     <li><%= error %></li>   <% end %> </ul> <% end %>  <%= form_tag sign_in_path %>   <div>     <%= label_tag :email %>     <%= email_field_tag :email %>      <%= label_tag :password %>     <%= password_field_tag :password %>    <%= submit_tag "sign in!" %>   <%= link_to "not member yet? sign up", sign_up_path %> <% end %> 

the main issue translating name html form on form_tag (do include name: "sentmessage"?). i've tried applying class , id tags html form on field tags, (but not sure if correct):

<%= form_tag sign_in_path %>   <div>     <%= label_tag :email %>     <%= email_field_tag :email, class: "form-control", id: "email"  %>      <%= label_tag :password %>     <%= password_field_tag :password, class: "form-control", id: "password" %>    <%= submit_tag "sign in!" %>   <%= link_to "not member yet? sign up", sign_up_path %> <% end %> 

you can pass options hash form tag additional form action, class attribute submit_tag, , input fields have specify value second argument before specifying html options, form goes this

<%= form_tag sign_in_path, {name: "sentmessage", novalidate:""} %>   <%= label_tag :email %>   <%= email_field_tag :email, '', class: "form-control", id: "email"  %>    <%= label_tag :password %>   <%= password_field_tag :password, '', class: "form-control", id: "password" %>    <%= submit_tag "sign in!", class:"btn btn-default pull-right send" %>   <%= link_to "not member yet? sign up", sign_up_path %> <% end %> 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -