if i got a couple of radio buttons on my form that i want to use a published_at field rather than a boolean field how would i go about this? I know that if i''m using a boolean i can do the following. <%= f.radio_button :published_at, true %> Yes <%= f.radio_button :published_at, false %> No but what would i have to change to use the datetime field? many thanks in advance guys, -- 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 -~----------~----~----~----~------~----~------~--~---
On 15 Apr 2009, at 12:05, Dave Smith wrote:> > if i got a couple of radio buttons on my form that i want to use a > published_at field rather than a boolean field how would i go about > this? I know that if i''m using a boolean i can do the following. > > <%= f.radio_button :published_at, true %> Yes > <%= f.radio_button :published_at, false %> No > > but what would i have to change to use the datetime field? >Are you expecting people to enter a date or to choose between one of several dates ? Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 15 Apr 2009, at 12:05, Dave Smith wrote: > >> >> if i got a couple of radio buttons on my form that i want to use a >> published_at field rather than a boolean field how would i go about >> this? I know that if i''m using a boolean i can do the following. >> >> <%= f.radio_button :published_at, true %> Yes >> <%= f.radio_button :published_at, false %> No >> >> but what would i have to change to use the datetime field? >> > Are you expecting people to enter a date or to choose between one of > several dates ? > > FredHi, i was actually hoping for when they check the yes option is puts the current time in the field. and when they click no it is removed. -- 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 -~----------~----~----~----~------~----~------~--~---
On 15 Apr 2009, at 12:54, Dave Smith wrote:> > Frederick Cheung wrote: >> On 15 Apr 2009, at 12:05, Dave Smith wrote: >> >>> >>> if i got a couple of radio buttons on my form that i want to use a >>> published_at field rather than a boolean field how would i go about >>> this? I know that if i''m using a boolean i can do the following. >>> >>> <%= f.radio_button :published_at, true %> Yes >>> <%= f.radio_button :published_at, false %> No >>> >>> but what would i have to change to use the datetime field? >>> >> Are you expecting people to enter a date or to choose between one of >> several dates ? >> >> Fred > > Hi, > > i was actually hoping for when they check the yes option is puts the > current time in the field. and when they click no it is removed.Ah, so that''s more than a radio button. it''s some radio buttons + your favourite date input method, together with a chunk of javascript that does stuff to those input controls. The radio_button would be for a separate attribute (which might not even be a real one) to published_at Fred> > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 15 Apr 2009, at 12:54, Dave Smith wrote: > >>>> <%= f.radio_button :published_at, false %> No >> i was actually hoping for when they check the yes option is puts the >> current time in the field. and when they click no it is removed. > > Ah, so that''s more than a radio button. it''s some radio buttons + your > favourite date input method, together with a chunk of javascript that > does stuff to those input controls. > The radio_button would be for a separate attribute (which might not > even be a real one) to published_at > > Fredahh ok! thanks, is that much more difficult to implement? i have searched for examples online and in my rails books but cannot find anything. -- 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 -~----------~----~----~----~------~----~------~--~---
On 15 Apr 2009, at 15:05, Dave Smith wrote:> > Frederick Cheung wrote: >> On 15 Apr 2009, at 12:54, Dave Smith wrote: >> >>>>> <%= f.radio_button :published_at, false %> No >>> i was actually hoping for when they check the yes option is puts the >>> current time in the field. and when they click no it is removed. >> >> Ah, so that''s more than a radio button. it''s some radio buttons + >> your >> favourite date input method, together with a chunk of javascript that >> does stuff to those input controls. >> The radio_button would be for a separate attribute (which might not >> even be a real one) to published_at >> >> Fred > > ahh ok! thanks, is that much more difficult to implement? i have > searched for examples online and in my rails books but cannot find > anything.Not massively difficult. Not a rails issue at all though - get out your html and javascript books to find out about event handling and so on. Fred> > -- > 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 -~----------~----~----~----~------~----~------~--~---