Hi all, I am new to this place and ruby on rails as well. I am developing a web application where I have to create a form which displays the checkboxes. The names of these checkboxes have to be fetched from a database. Can some one help me out of this ? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<%= check_box :modelname, :attribute, options, on_value, off_value %> Example: check_box "post", "validated" # post.validated? returns 1 or 0 <input type="checkbox" id="post_validate" name="post[validated]" value="1" checked="checked" /> <input name="post[validated]" type="hidden" value="0" /> check_box "puppy", "gooddog", {}, "yes", "no" <input type="checkbox" id="puppy_gooddog" name="puppy[gooddog]" value="yes" /> <input name="puppy[gooddog]" type="hidden" value="no" /> Just use it.. If you can''t understand, get back again -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
currently i am using this in my view, which makes it pretty hard coded...can u suggest something else in place of it(which dynamically fetches the checkbox names from a database) Also, I want to use two databases(one for fetching the checkbox names, and the other is for my application). Do I need to include some extra code for it? <html> <head> <title>Subscribe</title> </head> <body> <h2>Subscribe</h2> <% form_for :user do |form| %> <fieldset> <legend>Enter Your Details</legend> <label for="%parameter1">Parameter1:</label> <%= form.check_box :parameter1 %> </br> <label for="%parameter2">Parameter2:</label> <%= form.check_box :parameter2 %> </br> <label for="%parameter3">Parameter3:</label> <%= form.check_box :parameter3 %> </br> <%= submit_tag "Subscribe!", :class => "submit" %> </fieldset> <% end %> </body> </html> On Dec 10, 6:13 pm, Priya Buvan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> <%= check_box :modelname, :attribute, options, on_value, off_value %> > > Example: > > check_box "post", "validated" # post.validated? returns 1 or 0 > <input type="checkbox" id="post_validate" name="post[validated]" > value="1" checked="checked" /> > <input name="post[validated]" type="hidden" value="0" /> > > check_box "puppy", "gooddog", {}, "yes", "no" > <input type="checkbox" id="puppy_gooddog" name="puppy[gooddog]" > value="yes" /> > <input name="puppy[gooddog]" type="hidden" value="no" /> > > Just use it.. > If you can''t understand, get back again > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
some one please help me out. :( On Dec 11, 8:49 am, Navi023 <navneet030...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> currently i am using this in my view, which makes it pretty hard > coded...can u suggest something else in place of it(which dynamically > fetches the checkbox names from a database) > > Also, I want to use two databases(one for fetching the checkbox names, > and the other is for my application). Do I need to include some extra > code for it? > > <html> > <head> > <title>Subscribe</title> > </head> > <body> > <h2>Subscribe</h2> > > <% form_for :user do |form| %> > > <fieldset> > <legend>Enter Your Details</legend> > > <label for="%parameter1">Parameter1:</label> > <%= form.check_box :parameter1 %> > </br> > <label for="%parameter2">Parameter2:</label> > <%= form.check_box :parameter2 %> > </br> > <label for="%parameter3">Parameter3:</label> > <%= form.check_box :parameter3 %> > </br> > <%= submit_tag "Subscribe!", :class => "submit" %> > </fieldset> > <% end %> > > </body> > </html> > > On Dec 10, 6:13 pm, Priya Buvan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > <%= check_box :modelname, :attribute, options, on_value, off_value %> > > > Example: > > > check_box "post", "validated" # post.validated? returns 1 or 0 > > <input type="checkbox" id="post_validate" name="post[validated]" > > value="1" checked="checked" /> > > <input name="post[validated]" type="hidden" value="0" /> > > > check_box "puppy", "gooddog", {}, "yes", "no" > > <input type="checkbox" id="puppy_gooddog" name="puppy[gooddog]" > > value="yes" /> > > <input name="puppy[gooddog]" type="hidden" value="no" /> > > > Just use it.. > > If you can''t understand, get back again > > > -- > > Posted viahttp://www.ruby-forum.com/.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Anyone out there? please have a look at my query also. :( On Dec 11, 2:48 pm, Navi023 <navneet030...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> some one please help me out. :( > > On Dec 11, 8:49 am, Navi023 <navneet030...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > currently i am using this in my view, which makes it pretty hard > > coded...can u suggest something else in place of it(which dynamically > > fetches the checkbox names from a database) > > > Also, I want to use two databases(one for fetching the checkbox names, > > and the other is for my application). Do I need to include some extra > > code for it? > > > <html> > > <head> > > <title>Subscribe</title> > > </head> > > <body> > > <h2>Subscribe</h2> > > > <% form_for :user do |form| %> > > > <fieldset> > > <legend>Enter Your Details</legend> > > > <label for="%parameter1">Parameter1:</label> > > <%= form.check_box :parameter1 %> > > </br> > > <label for="%parameter2">Parameter2:</label> > > <%= form.check_box :parameter2 %> > > </br> > > <label for="%parameter3">Parameter3:</label> > > <%= form.check_box :parameter3 %> > > </br> > > <%= submit_tag "Subscribe!", :class => "submit" %> > > </fieldset> > > <% end %> > > > </body> > > </html> > > > On Dec 10, 6:13 pm, Priya Buvan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > > > <%= check_box :modelname, :attribute, options, on_value, off_value %> > > > > Example: > > > > check_box "post", "validated" # post.validated? returns 1 or 0 > > > <input type="checkbox" id="post_validate" name="post[validated]" > > > value="1" checked="checked" /> > > > <input name="post[validated]" type="hidden" value="0" /> > > > > check_box "puppy", "gooddog", {}, "yes", "no" > > > <input type="checkbox" id="puppy_gooddog" name="puppy[gooddog]" > > > value="yes" /> > > > <input name="puppy[gooddog]" type="hidden" value="no" /> > > > > Just use it.. > > > If you can''t understand, get back again > > > > -- > > > Posted viahttp://www.ruby-forum.com/.-Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Wed, Dec 10, 2008 at 7:49 PM, Navi023 <navneet030325-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > currently i am using this in my view, which makes it pretty hard > coded...can u suggest something else in place of it(which dynamically > fetches the checkbox names from a database) > > Also, I want to use two databases(one for fetching the checkbox names, > and the other is for my application). Do I need to include some extra > code for it?The doc for ActiveRecord::Base has a section titled "Connection to multiple databases in different models" Perhaps that would be a good place to start :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---