[Rails] Multiple Check Box
I had given like Java<%=check_box_tag "employees", "skills[]", "Java" %> Rails<%=check_box_tag "employees", "skills[]", "Rails" %> C<%=check_box_tag "employees", "skills[]", "C" %> since it belongs to the "employee" object. So both the checkboxes (Java and Rails) are selected in the "new" page. In the controller, I had given @employees = Employees.new(@params['employees']) @employees.save Also in the DB, I am having a table called as "employees" and in that "skills" is a column. Is it possible in DB to have a single column "skills" for multiple checkboxes (Java, Rails and C) Could you please suggest what needs to be done. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Check Box and Radio Button
Thanks Salil for your help. I had given like Java<%=check_box_tag "employees", "skills[]", "Java" %> Rails<%=check_box_tag "employees", "skills[]", "Rails" %> since it belongs to the "employee" object. So both the checkboxes (Java and Rails) are selected in the "new" page. In the controller, I had given @employees = Employees.new(@params['employees']) @employees.save Also in the DB, I am having a table called as "employees" and in that "skills" is a column. Is it possible to have a single column "skills" for multiple checkboxes (Java, Rails and C) Can you please suggest what needs to be done. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Check Box and Radio Button
Salil Gaikwad wrote: > >> I am using multiple check box and a radio >> button and when I click the "Submit" button, it calls the "create" >> method it is inserting only 1 value for checkbox and also for the radio >> button. >> Could you please tell how to insert multiple check box values in create. >> Please send me the link if you have any sample programs. > <% for something in @something %> ><%= check_box_tag name[], somethind.id, checked = false %> > <% end %> > and you receive the id's of the checked check boxes in array of name > i.e. params[:name] __ Thanks Salil for your reply. I am using the checkbox and following is the code. Java<%=check_box("employees", "skills", {}, "Java", "Java")%> Rails<%=check_box("employees", "skills", {}, "Rails", "Rails")%> C<%=check_box("employees", "skills", {}, "C", "C")%> Here even if I select both Java and Rails, only Java value is selected and inserting in database. Could you please tell to make both the values inserted into the database. Also, in the scaffold edit page, the default "edit" method displays all the fields (including checkbox and radio buttons) as "text_field"(text box) with only single value. Could you please tell how to populate multiple checkbox and radio buttons in the edit page with the values populating. Please send me the link if you have any sample programs. __ -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Check Box and Radio Button
I am using multiple check box and a radio button and when I click the "Submit" button, it calls the "create" method it is inserting only 1 value for checkbox and also for the radio button. Could you please tell how to insert multiple check box values in create. Please send me the link if you have any sample programs. Also, in the scaffold edit page, the default "edit" method displays all the fields (including checkbox and radio buttons) as "text_field"(text box) with only single value. Could you please tell how to populate multiple checkbox and radio buttons in the edit page with the values populating. Please send me the link if you have any sample programs. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Multiple CheckBox and Radio Buttons
I am using multiple check box (more than 1 checkboxes) and a radio button and when I click the "Submit" button, it calls the "create" method it is inserting only 1 value for checkbox and also for the radio button. Could you please tell how to insert multiple check box values in create. Also, in the scaffold edit page, the default "edit" method displays all the fields (including checkbox and radio buttons) as "text_field"(text box) with only single value. Could you please tell how to populate multiple checkbox and radio buttons in the edit page with the values populating. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Please help in Multiple Checkbox and RadioButtons
I am using multiple check box (more than 1 checkboxes) and a radio button and when I click the "Submit" button, it calls the "create" method it is inserting only 1 value for checkbox and also for the radio button. How to insert multiple check box values in create. Also, in the scaffold edit page, the default "edit" method displays all the fields (including checkbox and radio buttons) as "text_field"(text box) with only single value. How to populate multiple checkbox and radio buttons in the edit page with the values populating. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---