I am using rails-bootstrap-forms gem with devise form_tag

人走茶凉 提交于 2019-12-25 01:14:14

问题


I am using rails-bootstrap-forms gem with devise. How i can customize form_tag with bootstrap with gem rails-bootstrap-forms. My code is

<%= form_tag topic_posts_path(@topic) do %>
    <%= render 'form' %>
    <%= submit_tag 'Create post' %>

<%end%>

and my partial _form is

    <h2>Create new post</h2>


    <%= label :post, :description %>
    <%= text_area :post, :description %>

I want something like

<div class="form-group">
    <label for="xyz">xyz</label>
    <input type="email" class="form-control" id="xyz" placeholder="Enter xyz">
  </div>

any help ?


回答1:


So what you want is to have input fields wrapped with <div class="form-group">...</div>. Replace form_tag with bootstrap_form_for. Replace text_area with f.text_area. That's how you already got your signup form work.



来源:https://stackoverflow.com/questions/27334652/i-am-using-rails-bootstrap-forms-gem-with-devise-form-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!