I''m creating a simple ''Yes/No'' select droplist. I thought the select tag accepted a hash. But, it doesn''t show any items when I view it. This is the code in Markaby 0.5. select_tag( ''work_order'', ''warranty_work_ny'',{"Yes" => "Y", "No" => "N"}) There must be an obvious error in there somewhere, I''m just not seeing it. -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Larry Kelly wrote:> I''m creating a simple ''Yes/No'' select droplist. I thought the select > tag accepted a hash. But, it doesn''t show any items when I view it. > This is the code in Markaby 0.5. > > select_tag( ''work_order'', ''warranty_work_ny'',{"Yes" => "Y", "No" => > "N"}) > > There must be an obvious error in there somewhere, I''m just not seeing > it. > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Bensontry select_tag(name, option_tags = nil, options = {}) but select(object, method, choices, options = {}, html_options = {}) try select_tag( ''warranty_work_ny'',{"Yes" => "Y", "No" => "N"}) -- 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 -~----------~----~----~----~------~----~------~--~---
You want the select helper, not select_tag, since you are tying it to your work_order.warranty_work_ny method. This helper accepts an array of arrays for the choices, not a hash. Here''s how you do it... select(''work_order'', ''warranty_work_ny'', [["Yes","Y"],["No","N"]]) c. Larry Kelly wrote:> I''m creating a simple ''Yes/No'' select droplist. I thought the select > tag accepted a hash. But, it doesn''t show any items when I view it. > This is the code in Markaby 0.5. > > select_tag( ''work_order'', ''warranty_work_ny'',{"Yes" => "Y", "No" => > "N"}) > > There must be an obvious error in there somewhere, I''m just not seeing > it. > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson-- 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 -~----------~----~----~----~------~----~------~--~---
On Oct 16, 1:44 am, "Larry Kelly" <ldk2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m creating a simple ''Yes/No'' select droplist. I thought the select > tag accepted a hash. But, it doesn''t show any items when I view it. > This is the code in Markaby 0.5. > > select_tag( ''work_order'', ''warranty_work_ny'',{"Yes" => "Y", "No" => "N"}) > > There must be an obvious error in there somewhere, I''m just not seeing it. > -- > Best Regards, > -Larry > "Work, work, work...there is no satisfactory alternative." > --- E.Taft Benson>From a user interface perspective, a ''select'' for a yes/no question isa bad idea. For a boolean state object I suggest one of two approaches.... 1. A checkbox or 2. two radio buttons. In your case, it sounds like you really need to put in a checkbox I use the radio button approach when the states match to a small set of mutually exclusive states that don''t neatly map to a true/false. Things like ''gender'' are a good example. _Kevin --~--~---------~--~----~------------~-------~--~----~ 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 16 Oct 2006, at 14:48, _Kevin wrote:> On Oct 16, 1:44 am, "Larry Kelly" <ldk2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I''m creating a simple ''Yes/No'' select droplist. I thought the select >> tag accepted a hash. But, it doesn''t show any items when I view it. >> This is the code in Markaby 0.5. >> >> select_tag( ''work_order'', ''warranty_work_ny'',{"Yes" => "Y", "No" >> => "N"}) >> >> There must be an obvious error in there somewhere, I''m just not >> seeing it.select_tag takes: name for params, options for popup, html options. So you have an extra argument slipped in there, and you should really use options_for_select to build the options string. try: select_tag(:warranty_work_ny, options_for_select({"Yes" => "Y", "No" => "N"})) (typed into mail, apologies in advance for the errors)> From a user interface perspective, a ''select'' for a yes/no question is > a bad idea.From the survey design PoV, any binary (Yes/No) question has four possible and appropriate responses: Yes; No; Don''t know; not applicable. Plus also: Not Answered.> For a boolean state object I suggest one of two approaches.... > 1. A checkbox or > 2. two radio buttons. > > In your case, it sounds like you really need to put in a checkbox > > I use the radio button approach when the states match to a small > set of > mutually exclusive states that don''t neatly map to a true/false. > Things like ''gender'' are a good example.Most binary survey questions fall into the same camp. From the UI perspective, popups/dropdowns are biased towards the first option, the one that shows by default. Paul --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---