% address_id = address_type.chars.first %>
>
<%= form.label :firstname, t(:first_name) %>*
<%= form.text_field :firstname, :class => 'required' %>
>
<%= form.label :lastname, t(:last_name) %>*
<%= form.text_field :lastname, :class => 'required' %>
>
<%= form.label :company, t(:company) %>
<%= form.text_field :company %>
>
<%= form.label :address1, t(:street_address) %>*
<%= form.text_field :address1, :class => 'required' %>
>
<%= form.label :address2, t(:street_address_2) %>
<%= form.text_field :address2 %>
>
<%= form.label :city, t(:city) %>*
<%= form.text_field :city, :class => 'required' %>
>
<%= form.label :country_id, t(:country) %>*
>
<%= form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'required'} %>
>
<% have_states = !address.country.states.empty? %>
<%= form.label :state, t(:state) %>>*
<% state_elements = [
form.collection_select(:state_id, address.country.states,
:id, :name,
{:include_blank => true},
{:class => have_states ? 'required' : 'hidden',
:disabled => !have_states}) +
form.text_field(:state_name,
:class => !have_states ? 'required' : 'hidden',
:disabled => have_states)
].join.gsub('"', "'").gsub("\n", "")
%>
<%= javascript_tag do -%>
document.write("<%== state_elements %>");
<% end %>
>
<%= form.label :zipcode, t(:zip) %>*
<%= form.text_field :zipcode, :class => 'required' %>
>
<%= form.label :phone, t(:phone) %>*
<%= form.phone_field :phone, :class => 'required' %>
>
<%= form.label :alternative_phone, t(:alternative_phone) %>
<%= form.phone_field :alternative_phone %>