Hey John
Thanks for insights, they were really helpful
But I am having a hard time getting the data from the checkboxes into the
database.
 Have a look at the code -

*      <%= f.label :expertise,"Kindly select your field of expertise" %>*
*      <%= f.check_box :expertise %>*
*      <%= label_tag(:expertise, "Fundraising") %>*
*      <%= check_box_tag(:expertise) %>*
*      <%= label_tag(:expertise, "Enhancing Sales") %>*

For normal text fields this is the code-
*      <%= f.label :fname,"First Name" %>*
*      <%= f.text_field :fname,:class=>"form-control" %>*
 This works perfectly fine.

Thanks in advance
Regards

*Varun Wachaspati J*
*B.E.(Hons.)Computer Science | LinkedIn
<https://www.linkedin.com/profile/view?id=262723055&authType=name&authToken=XtkG&trk=api*a109924*s118458*>
|
+91-8094068111*

*Birla Institute of Technology & Science,* Pilani


On Sat, Dec 20, 2014 at 6:30 PM, John Wilkinson <jcwilk / gmail.com> wrote:

> 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
>>
>>