Answers.Body: <p><s>That's by design, slugs are used for building the url to link to a specific element, in this case, a category.</s></p>
  
  <p><strong>Edit:</strong> seems I was wrong on the above, see comment. Leaving the rest of the answer as using the ID offers a solution. </p>
  
  <p>You'll have to use the id to refer to the category as value, like so: </p>
  
  <pre><code>&lt;select name="field-styles" id="field-styles" class="select"&gt;
      &lt;option value=""&gt;Style&lt;/option&gt;
      {% for style in craft.categories.group('productStyles').order('title') %}
      &lt;option value="{{ style.id }}"&gt;{{ style.title }}&lt;/option&gt;
      {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-30T12:57:55.027Z
Answers.Text: Hey Michael, thanks for the response. According to the makers it should work regardless. I believe in your case, the `url` variable would not be available: https://twitter.com/craftcms/status/902730869768691712
Answers.UserDisplayName: Siebird
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-30T13:03:42.613Z
Answers.Text: Than I'll gladly wait for someone else to chime in, I'll edit my answer. Still using the ID should work as a (temporary) solution
Answers.UserDisplayName: mrsmn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-30T12:55:53.470Z
Answers.LastActivityDate: 2017-08-30T13:08:13.480Z
Answers.LastEditDate: 2017-08-30T13:08:13.480Z
Answers.UserDisplayName: mrsmn
Body: <p>Just like the title states, the <code>slug</code> variable is not available when a category's url are disabled:</p>
  
  <pre><code>&lt;select name="field-styles" id="field-styles" class="select"&gt;
      &lt;option value=""&gt;Style&lt;/option&gt;
      {% for style in craft.categories.group('productStyles').order('title') %}
      &lt;option value="{{ style.slug }}"&gt;{{ style.title }}&lt;/option&gt;
      {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
  <p>The snippet of code above works when the URL's are enabled for this category group. When disabled, the input <code>value</code> is blank.</p>
  
Tags: <categories><slug>
Title: Category slug variable is not available when category url's are disabled
ThreadText: # Category slug variable is not available when category url's are disabled
  
  (Asked by: username_0 on 2017-08-30)
  
  Just like the title states, the `slug` variable is not available when a category's url are disabled:
  
  ```
  <select name="field-styles" id="field-styles" class="select">
      <option value="">Style</option>
      {% for style in craft.categories.group('productStyles').order('title') %}
      <option value="{{ style.slug }}">{{ style.title }}</option>
      {% endfor %}
  </select>
  
  ```
  
  The snippet of code above works when the URL's are enabled for this category group. When disabled, the input `value` is blank.
  
  **Tags:** categories, slug
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-30. Score: 1
  
  ~~That's by design, slugs are used for building the url to link to a specific element, in this case, a category.~~
  
  **Edit:** seems I was wrong on the above, see comment. Leaving the rest of the answer as using the ID offers a solution.
  
  You'll have to use the id to refer to the category as value, like so:
  
  ```
  <select name="field-styles" id="field-styles" class="select">
      <option value="">Style</option>
      {% for style in craft.categories.group('productStyles').order('title') %}
      <option value="{{ style.id }}">{{ style.title }}</option>
      {% endfor %}
  </select>
  
  ```
  
  > **Comments:**
  > **username_0**: Hey Michael, thanks for the response. According to the makers it should work regardless. I believe in your case, the `url` variable would not be available: https://twitter.com/craftcms/status/902730869768691712  
  > **username_1**: Than I'll gladly wait for someone else to chime in, I'll edit my answer. Still using the ID should work as a (temporary) solution  
  
  ---
  
  