将HTML表单转换为Rails表单:帮助完整的菜鸟

时间:2017-03-14 03:37:21

标签: html ruby-on-rails

我是Rails的新手我有一个HTML表单,但我不知道如何保留CSS类。只需将表单转换为rails。

<form action="#" method="post" autocomplete="off">
    <div class="lx-contact-field">
        <input type="text" name="fullname" placeholder="Jane Doe" />
    </div>
    <div class="lx-contact-field">
        <input type="text" name="email" placeholder="Jane@Doe.com" />
    </div>
    <div class="lx-contact-field">
        <textarea name="message" placeholder="Your message here ..."></textarea>
    </div>
    <input type="button" name="submit" value="SEND MESSAGE" />
</form>

1 个答案:

答案 0 :(得分:0)

您可以在div中保留CSS类,并将Rtml输入字段替换为Rails textfield

<div class="lx-contact-field">
   <%= f.text_field :full_name, placeholder: "Jane Doe" %>
</div>