Answers.Body: <p>This ended up being a css issue. In the CSS I had to create the following rule.</p>
  
  <pre><code>input[type="text"].hidden { display: none; }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-12T08:59:29.613Z
Answers.LastActivityDate: 2016-07-12T08:59:29.613Z
Answers.UserDisplayName: Dan Lee
Body: <p>In the Address section I have been defining UK counties to populate the State field when a Country is selected. I noticed that there is a standard text input when there is no defined states/regions/areas for a country and a drop down field for states when there is defined states. </p>
  
  <p>When a country like the US or the UK is selected both fields are shown however ideally it should only be the dropdown. See image of the problem:</p>
  
  <p><img src="https://i.sstatic.net/fOKke.png" alt="screenshot"></p>
  
  <p>Is there any logic that can be added to toggle it on/off ?</p>
  
  <pre><code>&lt;label for="{{ modelName }}-state"&gt;County / State / Region&lt;/label&gt;
  
  {% set options = (model and states[model.countryId] is defined ? states[model.countryId] : []) %}
  &lt;select id="{{ modelName }}-stateId" data-modelname="{{ modelName }}" class="address-stateId u-full-width {% if options|length == 0 or (model and model.stateName) %}hidden{% endif %}" name="{{ modelName }}[stateValue]"&gt;
    {% for key, option in options %}
      {% set optionValue = (model ? model.stateId : '') %}
      &lt;option value="{{ key }}" {% if key == optionValue %}selected{% endif %}&gt;{{ option }}&lt;/option&gt;
    {% endfor %}
  &lt;/select&gt;
  
  &lt;input type="text" data-modelname="{{ modelName }}" id="{{ modelName }}-stateName" class="address-stateName {% if options|length &gt; 0 or (model and model.stateId) %}hidden{% endif %} u-full-width" {% if model and model.stateName %}name="{{ modelName }}[stateValue]" value="{{ model.stateName}}"{% endif %}&gt;
  </code></pre>
  
Tags: <plugin-craftcommerce>
Title: Craft Commerce: Duplicate Input for Address State?
ThreadText: # Craft Commerce: Duplicate Input for Address State?
  
  (Asked by: username_0 on 2016-06-29)
  
  In the Address section I have been defining UK counties to populate the State field when a Country is selected. I noticed that there is a standard text input when there is no defined states/regions/areas for a country and a drop down field for states when there is defined states.
  
  When a country like the US or the UK is selected both fields are shown however ideally it should only be the dropdown. See image of the problem:
  
  ![screenshot](https://i.sstatic.net/fOKke.png)
  
  Is there any logic that can be added to toggle it on/off ?
  
  ```
  <label for="{{ modelName }}-state">County / State / Region</label>
  
  {% set options = (model and states[model.countryId] is defined ? states[model.countryId] : []) %}
  <select id="{{ modelName }}-stateId" data-modelname="{{ modelName }}" class="address-stateId u-full-width {% if options|length == 0 or (model and model.stateName) %}hidden{% endif %}" name="{{ modelName }}[stateValue]">
    {% for key, option in options %}
      {% set optionValue = (model ? model.stateId : '') %}
      <option value="{{ key }}" {% if key == optionValue %}selected{% endif %}>{{ option }}</option>
    {% endfor %}
  </select>
  
  <input type="text" data-modelname="{{ modelName }}" id="{{ modelName }}-stateName" class="address-stateName {% if options|length > 0 or (model and model.stateId) %}hidden{% endif %} u-full-width" {% if model and model.stateName %}name="{{ modelName }}[stateValue]" value="{{ model.stateName}}"{% endif %}>
  
  ```
  
  **Tags:** plugin-craftcommerce
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-07-12. Score: 0 | Accepted answer
  
  This ended up being a css issue. In the CSS I had to create the following rule.
  
  ```
  input[type="text"].hidden { display: none; }
  
  ```
  
  
  ---
  
  