Very simple country select

Hi all,

Country select should be simple in rails, but my code below:

<%= country_select(:user, :country,
{:selected=>‘DK’,:include_blank=>true}) %>

is obviously a little too simple :slight_smile:

I get my drop-down list of countries, but the value I select on the page
doesn’t get saved. I get no errors, but the value in my sql database
isn’t updated. Can someone please tell me how to save the selected
country when I press ‘submit’.

Thanks.

Jan A. wrote:

Hi all,

Country select should be simple in rails, but my code below:

<%= country_select(:user, :country,
{:selected=>‘DK’,:include_blank=>true}) %>

is obviously a little too simple :slight_smile:

I get my drop-down list of countries, but the value I select on the page
doesn’t get saved. I get no errors, but the value in my sql database
isn’t updated. Can someone please tell me how to save the selected
country when I press ‘submit’.

Thanks.

Just off the top of my head, is your select helper inside a form?

Shandy N. wrote:

Jan A. wrote:

Hi all,

Country select should be simple in rails, but my code below:

<%= country_select(:user, :country,
{:selected=>‘DK’,:include_blank=>true}) %>

is obviously a little too simple :slight_smile:

I get my drop-down list of countries, but the value I select on the page
doesn’t get saved. I get no errors, but the value in my sql database
isn’t updated. Can someone please tell me how to save the selected
country when I press ‘submit’.

Thanks.

Just off the top of my head, is your select helper inside a form?

Thanks for the reply.

Yep. The complete bit of code looks like this:

<%= head_helper :error => true %> <%= start_form_tag_helper %> Select country:
<%= country_select(:user, :country, {:selected=>'DK',:include_blank=>true}) %> <%= render_partial 'edit', :user => @user, :submit => true %> <%= end_form_tag %>