form_for is one of the most quintessential ways to do forms in rails, and
so it therefore has extensive examples provided in the documentation. A
quick google for "rails form_for" turned up these guys with examples of all
the things you mentioned, even in erb:

http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html
http://guides.rubyonrails.org/form_helpers.html

Note though that, ideally, you want the @user variable to dictate the
values of the fields. In your example you have it explicitly drawing the
value out of lcurrent_user['firstName']. Maybe there's a way to adjust
@user so it already has that value assigned to fname so that the form
helper can automatically draw it out? Best to squeeze as much behavior out
of the view as you can.

Might be getting a bit too rails specific though *shrugs*

On Sat Dec 20 2014 at 4:36:53 AM Varun Wachaspati <varunwachaspati / gmail.com>
wrote:

> Hello Everyone
>
> While making a signup page for a simple web application I am supposed to
> use check boxes, radio buttons,text boxes ,etc. but have failed to do so.
> Though I have successfully generated a text field by using the following
> code.
>
> *    <%= form_for(@user) do |f| %>*
> *    <%= render 'shared/error_messages' %>*
> *    <div class="container">*
> *      <% flash.each do |key, value| %>*
> *        <div class="alert alert-<%= key %>"><%= value %></div>*
> *      <% end %>*
> *    </div>*
>
> *      <%= f.label :fname,"First Name" %>*
> *      <%= f.text_field :fname,:value =>
> lcurrent_user['firstName'],:class=>"form-control" %>*
>
> The above code generates a text field for first name
>
> Please suggest how to achieve the same for checkboxes, radio buttons,
> text-boxes,etc.
>
> PS- neglect if any tags are not closed.
> Regards
> *Varun Wachaspati J*
> *B.E.(Hons.)Computer Science | LinkedIn
> <https://mailtrack.io/trace/link/686bfc7ecd2b18f7473f9c5d13aab20aba51195b> |
> +91-8094068111*
>
> *Birla Institute of Technology & Science,* Pilani
>
>