Answers.Body: <p>Something like the following should work. This assumes that your category field handle is 'jobCategory', and has a limit set to 1.</p>
  
  <pre><code>{% set categories = craft.categories.group('jobCategory') %}
  {% set entryCategory = entry.jobCategory.first %}
  &lt;label for="fields[jobCategory]"&gt;Job Category:&lt;/label&gt;
  &lt;select id="jobCategory" name="fields[jobCategory]"&gt;
      {% for category in categories %}
          &lt;option value="{{ category.id }}" {% if category.title == entryCategory %}selected{% endif %}&gt;{{ category.title }}&lt;/option&gt;
      {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-20T17:46:27.540Z
Answers.Text: BOOM! Almost {% if category.title == entryCategory %} - if you update your answer, I'll accept it :)
Answers.UserDisplayName: Steven Grant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-20T17:53:14.713Z
Answers.Text: @StevenGrant Updated for Douglas.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-20T18:04:11.473Z
Answers.Text: Close. Glad you got it working. (And thanks brad.)
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-20T17:03:28.400Z
Answers.LastActivityDate: 2015-01-20T17:52:48.823Z
Answers.LastEditDate: 2015-01-20T17:52:48.823Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>I have this in my edit form</p>
  
  <pre><code>{% set categories = craft.categories.group('jobCategory') %}
      &lt;label for="fields[jobCategory]"&gt;Job Category:&lt;/label&gt;
      &lt;select id="jobCategory" name="fields[jobCategory]"&gt;
          {% for category in categories %}
              &lt;option value="{{ category.id }}"&gt;{{ category.title }}&lt;/option&gt;
          {% endfor %}
      &lt;/select&gt;
  </code></pre>
  
  <p>but can't for the life of me, show select as 'selected' for the category the entry belongs to.</p>
  
  <p>Missing something simple I'm sure.</p>
  
Tags: <categories><frontend><category><editor>
Title: frontend editing, show selected category
ThreadText: # frontend editing, show selected category
  
  (Asked by: username_0 on 2015-01-20)
  
  I have this in my edit form
  
  ```
  {% set categories = craft.categories.group('jobCategory') %}
      <label for="fields[jobCategory]">Job Category:</label>
      <select id="jobCategory" name="fields[jobCategory]">
          {% for category in categories %}
              <option value="{{ category.id }}">{{ category.title }}</option>
          {% endfor %}
      </select>
  
  ```
  
  but can't for the life of me, show select as 'selected' for the category the entry belongs to.
  
  Missing something simple I'm sure.
  
  **Tags:** categories, frontend, category, editor
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-20. Score: 2 | Accepted answer
  
  Something like the following should work. This assumes that your category field handle is 'jobCategory', and has a limit set to 1.
  
  ```
  {% set categories = craft.categories.group('jobCategory') %}
  {% set entryCategory = entry.jobCategory.first %}
  <label for="fields[jobCategory]">Job Category:</label>
  <select id="jobCategory" name="fields[jobCategory]">
      {% for category in categories %}
          <option value="{{ category.id }}" {% if category.title == entryCategory %}selected{% endif %}>{{ category.title }}</option>
      {% endfor %}
  </select>
  
  ```
  
  > **Comments:**
  > **username_0**: BOOM! Almost {% if category.title == entryCategory %} - if you update your answer, I'll accept it :)  
  > **username_2**: @username_0 Updated for username_1.  
  > **username_1**: Close. Glad you got it working. (And thanks username_2.)  
  
  ---
  
  