I thought I''d mailed this already, but I haven''t seen it show up on the list, so I''m mailing it again. My apologies if it does show up twice now. I want something really simple: I want a date_select that has blanks (:include_blanks works fine so far), but having an empty value in the select box on the webpage is ugly, so I want something more informative there, like "month" or "select a month" or something. In other words: <select id="user_birthdate_2i" name="user[birthdate(2i)]"> <option value="">Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> How do I do that? I can''t find any way to accomplish this in any docs nor in the source, yet it seems like a really obvious thing to want to do. Martijn. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There is an option prompt like <%= select("model", "status_id", Status.find(:all).collect {|p| [ p.name, p.id ] },options ={:prompt => "<< Select any >>"}) %> I think you can do similarly Sijo -- 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 Dec 11, 2008, at 12:08 PM, Sijo Kg wrote:> > There is an option prompt like > <%= select("model", "status_id", Status.find(:all).collect {|p| [ > p.name, p.id ] },options ={:prompt => "<< Select any >>"}) %> > > I think you can do similarlyDoesn''t seem to work in date_select. And throwing away the power of date_select in order to handle everything myself seems like a bad idea. I''d rather add this functionality to date_select. Martijn. --~--~---------~--~----~------------~-------~--~----~ 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 11 Dec 2008, at 11:37, Martijn Vos wrote:> > > On Dec 11, 2008, at 12:08 PM, Sijo Kg wrote: > >> >> There is an option prompt like >> <%= select("model", "status_id", Status.find(:all).collect {|p| [ >> p.name, p.id ] },options ={:prompt => "<< Select any >>"}) %> >> >> I think you can do similarly > > Doesn''t seem to work in date_select. And throwing away the > power of date_select in order to handle everything myself seems > like a bad idea. I''d rather add this functionality to date_select. > >If you''re worrying about good UI, date_select is pretty horrible anyway. Would be something of a lipstick on a pig thing. Fred> Martijn. > > >--~--~---------~--~----~------------~-------~--~----~ 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 Dec 11, 2008, at 1:19 PM, Frederick Cheung wrote:> On 11 Dec 2008, at 11:37, Martijn Vos wrote: >> On Dec 11, 2008, at 12:08 PM, Sijo Kg wrote: >>> >>> There is an option prompt like >>> <%= select("model", "status_id", Status.find(:all).collect {|p| [ >>> p.name, p.id ] },options ={:prompt => "<< Select any >>"}) %> >>> >>> I think you can do similarly >> >> Doesn''t seem to work in date_select. And throwing away the >> power of date_select in order to handle everything myself seems >> like a bad idea. I''d rather add this functionality to date_select. >> > If you''re worrying about good UI, date_select is pretty horrible > anyway. Would be something of a lipstick on a pig thing.Until I needed to add a nil option, date_select worked fine for me. What''s so wrong with it (other than this particular issue)? And is there a better alternative availlable? Thanks, Martijn. --~--~---------~--~----~------------~-------~--~----~ 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 11 Dec 2008, at 12:55, Martijn Vos wrote:> > > On Dec 11, 2008, at 1:19 PM, Frederick Cheung wrote: >> On 11 Dec 2008, at 11:37, Martijn Vos wrote: >>> On Dec 11, 2008, at 12:08 PM, Sijo Kg wrote: >>>> >>>> There is an option prompt like >>>> <%= select("model", "status_id", Status.find(:all).collect {|p| [ >>>> p.name, p.id ] },options ={:prompt => "<< Select any >>"}) %> >>>> >>>> I think you can do similarly >>> >>> Doesn''t seem to work in date_select. And throwing away the >>> power of date_select in order to handle everything myself seems >>> like a bad idea. I''d rather add this functionality to date_select. >>> >> If you''re worrying about good UI, date_select is pretty horrible >> anyway. Would be something of a lipstick on a pig thing. > > Until I needed to add a nil option, date_select worked fine for > me. What''s so wrong with it (other than this particular issue)? > And is there a better alternative availlable?People have a hard time working with stuff like ''20th december''. Is that a saturday or a sunday etc... Or they''re thinking in terms of ''next monday'' and things like that, in which case it''s a lot simpler if they don''t have to do the date maths themselves. Fred> > > > Thanks, > Martijn. > > >--~--~---------~--~----~------------~-------~--~----~ 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 Dec 11, 2008, at 1:59 PM, Frederick Cheung wrote:> On 11 Dec 2008, at 12:55, Martijn Vos wrote: >> On Dec 11, 2008, at 1:19 PM, Frederick Cheung wrote: >>> On 11 Dec 2008, at 11:37, Martijn Vos wrote: >>>> On Dec 11, 2008, at 12:08 PM, Sijo Kg wrote: >>>>> >>>>> There is an option prompt like >>>>> <%= select("model", "status_id", Status.find(:all).collect {|p| [ >>>>> p.name, p.id ] },options ={:prompt => "<< Select any >>"}) %> >>>>> >>>>> I think you can do similarly >>>> >>>> Doesn''t seem to work in date_select. And throwing away the >>>> power of date_select in order to handle everything myself seems >>>> like a bad idea. I''d rather add this functionality to date_select. >>>> >>> If you''re worrying about good UI, date_select is pretty horrible >>> anyway. Would be something of a lipstick on a pig thing. >> >> Until I needed to add a nil option, date_select worked fine for >> me. What''s so wrong with it (other than this particular issue)? >> And is there a better alternative availlable? > > People have a hard time working with stuff like ''20th december''. Is > that a saturday or a sunday etc... Or they''re thinking in terms of > ''next monday'' and things like that, in which case it''s a lot simpler > if they don''t have to do the date maths themselves.Point taken. But I''m using date_select for birth dates, so for me days of the week aren''t much of an issue. I just don''t want to force a default birth date on people who are unwilling to provide it. The day-month-year combo of date_select seems perfect for me so far, except for the inability to provide a nice text for the empty value. Martijn. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---