Using Country_select how to have default valur set to United States. I have a select drop down in my Ui to display the Country names. But i need United tates to be selected as default value. I use country_select to populate the country names. This is how i use <%= f.country_select :country, :selected=>''United States'' %> i also tried <%= f.country_select :country, :priority_countries=>''United States'' %> Do help me out to fix this.. Thanks in advance Ratnavel. -- 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 -~----------~----~----~----~------~----~------~--~---
helps? http://snippets.dzone.com/tag/country_select On Dec 6, 7:35 am, Ratnavel Sundaramurthi <rails-mailing-l...@andreas- s.net> wrote:> Using Country_select how to have default valur set to United States. > > I have a select drop down in my Ui to display the Country names. > > But i need United tates to be selected as default value. > > I use country_select to populate the country names. > > This is how i use <%= f.country_select :country, :selected=>''United > States'' %> > i also tried > <%= f.country_select :country, :priority_countries=>''United States'' %> > > Do help me out to fix this.. > > Thanks in advance > Ratnavel. > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
ebrad wrote:> helps? http://snippets.dzone.com/tag/country_select > > On Dec 6, 7:35 am, Ratnavel Sundaramurthi <rails-mailing-l...@andreas-Thanks for the reply ebrad I Used as this <%= form.country_select :billing_country, ["United States"] %>, its working.. BUT, This is adding a option extra in the top as United states, the same happened to me when i used the other two options which i mentioned earlier.. Is it possible to show the United States in the list selected as default. -- 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 -~----------~----~----~----~------~----~------~--~---
what brad suggested is the way to do it. This will select United States as the first country. On Dec 7, 2007 2:46 PM, Ratnavel Sundaramurthi < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > ebrad wrote: > > helps? http://snippets.dzone.com/tag/country_select > > > > On Dec 6, 7:35 am, Ratnavel Sundaramurthi <rails-mailing-l...@andreas- > > Thanks for the reply ebrad > > I Used as this > > <%= form.country_select :billing_country, ["United States"] %>, its > working.. > > BUT, > > This is adding a option extra in the top as United states, the same > happened to me when i used the other two options which i mentioned > earlier.. > > Is it possible to show the United States in the list selected as > default. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank u Ryan I implemented in the same way as u both suggested... -- 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> what brad suggested is the way to do it. This will select United States > as > the first country. > > On Dec 7, 2007 2:46 PM, Ratnavel Sundaramurthi < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> <%= form.country_select :billing_country, ["United States"] %>, its >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Ryan BiggHi, If you want to use the ''selected'' option instead of putting it as a priority country, you could try this <%= form.country_select :billing_country, [], {:selected => "United States"} %> Liang Zan -- 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 -~----------~----~----~----~------~----~------~--~---
> Hi, > > If you want to use the ''selected'' option instead of putting it as a > priority country, you could try this > > <%= form.country_select :billing_country, [], {:selected => "United > States"} %> > > Liang ZanI tried this, but still showing the first country ( afganestan ). do you have any idea about that ? 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 -~----------~----~----~----~------~----~------~--~---
Hi Please tell me how you solved it.Becasuse I have a similar problem..I am using two country_select as <%= country_select(:contact_address1, :country) %> <%= country_select(:contact_address2, :country) %> The above is working..But the default is Afganistan..How can I change this default to "UnitedStates" Thanks in advance 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 -~----------~----~----~----~------~----~------~--~---
I know this is a few years olf but just in case it helps anyone, you can use :prompt => true to add a ''please select'' default option -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.