Answers.Body: <p>You could always just use a <a href="http://buildwithcraft.com/docs/table-fields" rel="nofollow noreferrer">Table field</a>, you could then just add a colour to each row, this allows you to give a descriptive name to each colour but also keep the value as the hex or whatever format your colours are in...</p>
  
  <p><a href="https://i.sstatic.net/pm7qe.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pm7qe.jpg" alt="enter image description here"></a></p>
  
  <p>Then its easy to loop like:</p>
  
  <pre><code>{% for option in colorOptions.color %}
     &lt;option value="{{ option.value }}"&gt;{{ option.name }}&lt;/option&gt;
  {% endfor %}
  </code></pre>
  
  <p>Of course you dont have to have two columns, you could just have the one and loop over the HEX values or whatever, it's totally up to you and how you want to do it. But personally I think the table field is a solid way to go!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-15T13:55:26.930Z
Answers.Text: So obvious now. I was trying to force it with a dropdown, then checkboxes... Thank you!
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-15T09:08:32.487Z
Answers.LastActivityDate: 2015-09-15T09:08:32.487Z
Answers.UserDisplayName: Alec Ritson
Body: <p>I have a registration form that has a dropdown that allows the user to choose a color. This form input will be the same across all pages that allow a user to register.</p>
  
  <p>So, I thought using a Global to populate that dropdown would make sense as the client could manage the color choices. In essence, this is what I'm trying to do:</p>
  
  <pre><code>{% if colorOptions.color | length %}
      &lt;div class="form-group"&gt;
          &lt;label for="colorOption"&gt;Color Option&lt;/label&gt;
          &lt;select id="colorOption" class="form-control"&gt;
              &lt;option value=""&gt; Select&lt;/option&gt;
              {% for option in colorOptions.color %}
                  &lt;option value="{{ option }}"&gt;{{ option }}&lt;/option&gt;
              {% endfor %}
          &lt;/select&gt;
      &lt;/div&gt;
  {% endif %}
  </code></pre>
  
  <p>But I'm struggling with what kind of field type <code>color</code> needs/should/could be within the <code>colorOptions</code> group.</p>
  
Tags: <globals>
Title: How can I populate a dropdown via Globals?
ThreadText: # How can I populate a dropdown via Globals?
  
  (Asked by: username_0 on 2015-09-15)
  
  I have a registration form that has a dropdown that allows the user to choose a color. This form input will be the same across all pages that allow a user to register.
  
  So, I thought using a Global to populate that dropdown would make sense as the client could manage the color choices. In essence, this is what I'm trying to do:
  
  ```
  {% if colorOptions.color | length %}
      <div class="form-group">
          <label for="colorOption">Color Option</label>
          <select id="colorOption" class="form-control">
              <option value=""> Select</option>
              {% for option in colorOptions.color %}
                  <option value="{{ option }}">{{ option }}</option>
              {% endfor %}
          </select>
      </div>
  {% endif %}
  
  ```
  
  But I'm struggling with what kind of field type `color` needs/should/could be within the `colorOptions` group.
  
  **Tags:** globals
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-15. Score: 2 | Accepted answer
  
  You could always just use a [Table field](http://buildwithcraft.com/docs/table-fields), you could then just add a colour to each row, this allows you to give a descriptive name to each colour but also keep the value as the hex or whatever format your colours are in...
  
  [![enter image description here](https://i.sstatic.net/pm7qe.jpg)](https://i.sstatic.net/pm7qe.jpg)
  
  Then its easy to loop like:
  
  ```
  {% for option in colorOptions.color %}
     <option value="{{ option.value }}">{{ option.name }}</option>
  {% endfor %}
  
  ```
  
  Of course you dont have to have two columns, you could just have the one and loop over the HEX values or whatever, it's totally up to you and how you want to do it. But personally I think the table field is a solid way to go!
  
  > **Comments:**
  > **username_0**: So obvious now. I was trying to force it with a dropdown, then checkboxes... Thank you!  
  
  ---
  
  