how to make this form

21 views
Skip to first unread message

Roelof Wobben

unread,
Jul 14, 2014, 3:34:08 PM7/14/14
to rubyonra...@googlegroups.com
Hello,

I have read several pages but I cannot find how to make a form with this field ;

div class="field">
                    <label for="Login naam ">Login naam:</label>
                    <input type="text" id="firstname" name="firstname" value="" placeholder="login naam" class="login" />
                </div> <!-- /field -->

Can anyone give me a hint ?

Roelof

Eric Saupe

unread,
Jul 14, 2014, 6:35:41 PM7/14/14
to rubyonra...@googlegroups.com
<%= form_for @user do |f| %>
  <div class="field">
    <%= f.label :login_naam %>:
    <%= f.text_field :login_naam, class: "login", placeholder: "login naam" %><br />
  </div>

  <%= f.submit %>
<% end %>

You'll want to let Rails take care of the id's so they can match up the label with the field automatically as well as the name variable.

Take a read through http://www.railstutorial.org/book to get an idea of creating a simple application with all the of the basic building blocks explained.

Colin Law

unread,
Jul 15, 2014, 4:15:16 PM7/15/14
to rubyonra...@googlegroups.com
On 14 July 2014 23:35, Eric Saupe <eric...@gmail.com> wrote:
> <%= form_for @user do |f| %>
> <div class="field">
> <%= f.label :login_naam %>:
> <%= f.text_field :login_naam, class: "login", placeholder: "login naam"
> %><br />
> </div>
>
> <%= f.submit %>
> <% end %>
>
> You'll want to let Rails take care of the id's so they can match up the
> label with the field automatically as well as the name variable.
>
> Take a read through http://www.railstutorial.org/book to get an idea of
> creating a simple application with all the of the basic building blocks
> explained.

Even better would be to work right through the tutorial as I think I
have suggested already a couple of times.

In addition can I point out that it is good manners to come back when
you have solved a problem and post the solution for others that may
find your post later, also you could thank those that have tried to
help. I have noticed on several occasions that you have not responded
after suggestions are made, but just move on to another problem the
next day.

Regards

Colin
Reply all
Reply to author
Forward
0 new messages