Hi,
I have a select tag as :
<%= select(:feedbacks, :directedto , {"----Select
One----"=>"none","Business
contact"=>"Business Contact","Technical
support"=>"Technical Support","Payment
Help"=>"Payment Help"},{
:selected => "none"},
{:class=>"field", :style=>"width:192px;"}) %>
I want the select options in the drop down to appear in the same order
as I have written them in the code....
But...this does not happen..and the options appear in any random
order..!!!!
Can anyone please help me..as to how should I sort my select options..
Thank you...
-- 
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
-~----------~----~----~----~------~----~------~--~---
problem is that you are using a hash, which have no guaranteed order.
try an array like this:
  <%= select(:feedbacks, :directedto, ([["----Select One----",
"none"], ["Business contact", "Business Contact"],
["Technical
support", "Technical Support"], ["Payment Help",
"Payment Help"]]),
{:selected => "none"}, {:class=>"field",
:style=>"width:192px;"}) %>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
MaD wrote:> problem is that you are using a hash, which have no guaranteed order. > try an array like this: > > <%= select(:feedbacks, :directedto, ([["----Select One----", > "none"], ["Business contact", "Business Contact"], ["Technical > support", "Technical Support"], ["Payment Help", "Payment Help"]]), > {:selected => "none"}, {:class=>"field", :style=>"width:192px;"}) %>Thank You so much... That did the trick... Thanks 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 -~----------~----~----~----~------~----~------~--~---