One thing I haven''t figured out or found an answer to is if I create a select tag from a database table, how can I have an option for "Please select" or "choose" or whatever - I know i can do something like :include_blank => true. That works fine. I came across an option like :include_blank_text => ''something'', but that didn''t work. Anyone know how to do it ? Stuart -- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/19/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > One thing I haven''t figured out or found an answer to is if I create a > select tag from a database table, how can I have an option for "Please > select" or "choose" or whatever - > I know i can do something like :include_blank => true. That works > fine. I came across an option like :include_blank_text => ''something'', > but that didn''t work. > > Anyone know how to do it ?Add that option manually. @options = [[''Select from list'', '''']] + Product.find(:all, ...).map{|p| p.name, p.id} options_for_select(@options, ...) -- Rule Of Robustness: Robustness is the child of transparency and simplicity. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I can''t seem to make this work - This is what I have currently - <label for="<%= form_name -%>_<%= :state -%>">State</label><br /> <% @states = State.find(:all, :order => "name").map {|s| [s.name, s.id]} %> <%= f.select("state" , @states, "include_text" => ''please'' ) %><br /> Adding in the options seems to throw some parsing errors. Stuart On 9/19/06, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 9/19/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > One thing I haven''t figured out or found an answer to is if I create a > > select tag from a database table, how can I have an option for "Please > > select" or "choose" or whatever - > > I know i can do something like :include_blank => true. That works > > fine. I came across an option like :include_blank_text => ''something'', > > but that didn''t work. > > > > Anyone know how to do it ? > > Add that option manually. > > @options = [[''Select from list'', '''']] + Product.find(:all, > ...).map{|p| p.name, p.id} > > options_for_select(@options, ...) > > -- > Rule Of Robustness: Robustness is the child of transparency and > simplicity. > > > >-- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Okay, working now as; <label for="<%= form_name -%>_<%= :state -%>">State</label><br /> <% @states = State.find(:all, :order => "name").map {|s| [s.name, s.id]} %> <%= f.select("state" , [[''Please Select'', '''']] + @states ) %><br /> Does anyone know what the ''prompt'' option is in a select ? I came across mention of this in this patch message - http://dev.rubyonrails.org/ticket/3858 Haven''t found anything on it though. Stuart On 9/19/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I can''t seem to make this work - > > This is what I have currently - > <label for="<%= form_name -%>_<%= :state -%>">State</label><br /> > <% @states = State.find(:all, :order => "name").map {|s| [s.name, s.id]} %> > <%= f.select("state" , @states, "include_text" => ''please'' ) %><br /> > > Adding in the options seems to throw some parsing errors. > > Stuart > > > On 9/19/06, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On 9/19/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > One thing I haven''t figured out or found an answer to is if I create a > > > select tag from a database table, how can I have an option for "Please > > > select" or "choose" or whatever - > > > I know i can do something like :include_blank => true. That works > > > fine. I came across an option like :include_blank_text => ''something'', > > > but that didn''t work. > > > > > > Anyone know how to do it ? > > > > Add that option manually. > > > > @options = [[''Select from list'', '''']] + Product.find(:all, > > ...).map{|p| p.name, p.id} > > > > options_for_select(@options, ...) > > > > -- > > Rule Of Robustness: Robustness is the child of transparency and > > simplicity. > > > > > > > > > > > -- > http://en.wikipedia.org/wiki/Dark_ambient >-- http://en.wikipedia.org/wiki/Dark_ambient --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<% @states = [[''Please'', '''' ]] + State.find(:all, :order => "name").map {|s| [s.name, s.id]} %> <%= f.select("state" , @states ) %> Dark Ambient wrote:> I can''t seem to make this work - > > This is what I have currently - > <label for="<%= form_name -%>_<%= :state -%>">State</label><br /> > <% @states = State.find(:all, :order => "name").map {|s| [s.name, s.id]} %> > <%= f.select("state" , @states, "include_text" => ''please'' ) %><br /> > > Adding in the options seems to throw some parsing errors. > > Stuart > > > On 9/19/06, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On 9/19/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> One thing I haven''t figured out or found an answer to is if I create a >>> select tag from a database table, how can I have an option for "Please >>> select" or "choose" or whatever - >>> I know i can do something like :include_blank => true. That works >>> fine. I came across an option like :include_blank_text => ''something'', >>> but that didn''t work. >>> >>> Anyone know how to do it ? >>> >> Add that option manually. >> >> @options = [[''Select from list'', '''']] + Product.find(:all, >> ...).map{|p| p.name, p.id} >> >> options_for_select(@options, ...) >> >> -- >> Rule Of Robustness: Robustness is the child of transparency and >> simplicity. >> >> > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---