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.
helps? http://snippets.dzone.com/tag/country_select
On Dec 6, 7:35 am, Ratnavel S. <rails-mailing-l…@andreas-
ebrad wrote:
helps? http://snippets.dzone.com/tag/country_select
On Dec 6, 7:35 am, Ratnavel S. <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.
Thank u Ryan I implemented in the same way as u both suggested…
Ryan B. 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 S. <
[email protected]> wrote:
<%= form.country_select :billing_country, [“United States”] %>, its
–
Posted via http://www.ruby-forum.com/.
–
Ryan B.
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 Zan
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 Zan
I tried this, but still showing the first country ( afganestan ). do
you have any idea about that ?
thank you
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 S. <
[email protected]> wrote:
<%= form.country_select :billing_country, [“United States”] %>, its
–
Posted via http://www.ruby-forum.com/.
–
Ryan B.
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
how to add defult value to the country_select gem… pls help me
On Thu, Mar 13, 2014 at 1:26 AM, Anu S. [email protected]
wrote:
how to add defult value to the country_select gem… pls help me
I don’t know for sure, but I think you can pass in an option:
:selected => code
where code is the country code.
I know this is a few years old but just in case it helps anyone, you can
use :prompt => true to add a ‘please select’ default option
tamouse m. wrote in post #1139937:
On Thu, Mar 13, 2014 at 1:26 AM, Anu S. [email protected]
wrote:
how to add defult value to the country_select gem… pls help me
I don’t know for sure, but I think you can pass in an option:
:selected => code
where code is the country code.
not working…
On Wed, Apr 2, 2014 at 10:52 PM, Anu S. [email protected]
wrote:
tamouse m. wrote in post #1139937:
On Thu, Mar 13, 2014 at 1:26 AM, Anu S. [email protected]
wrote:
how to add defult value to the country_select gem… pls help me
I don’t know for sure, but I think you can pass in an option:
:selected => code
where code is the country code.
not working…
Show your code.
This is on the README page:
Supplying additional html options:
country_select("user", "country", { priority_countries: ["GB",
“FR”] }, { selected: “GB”, class: ‘form-control’ })
here s my code
<%=country_select(“profile”, “country”, { priority_countries: [“GB”,
“FR”] }, { selected: “GB”)%>
after excecuting the code. default country selected as afganistan… no
change…
pls help me to find a solution
tamouse m. wrote in post #1141848:
On Wed, Apr 2, 2014 at 10:52 PM, Anu S. [email protected]
wrote:
tamouse m. wrote in post #1139937:
On Thu, Mar 13, 2014 at 1:26 AM, Anu S. [email protected]
wrote:
how to add defult value to the country_select gem… pls help me
I don’t know for sure, but I think you can pass in an option:
:selected => code
where code is the country code.
not working…
Show your code.
This is on the README page:
Supplying additional html options:
country_select("user", "country", { priority_countries: ["GB",
“FR”] }, { selected: “GB”, class: ‘form-control’ })
here s my code
<%=country_select(“profile”, “country”, { priority_countries: [“GB”,
“FR”] }, { selected: “GB”)%>
after excecuting the code. default country selected as afganistan… no
change…
pls help me to find a solution