Answers.Body: <p>@carlcs helped me stumble upon a solution. Using the <code>.level(2)</code> method gave the desired result.</p>
  
  <p><code>{% set cats =  entry.categoryInput.level(2) %}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T19:17:28.587Z
Answers.LastActivityDate: 2015-10-28T19:17:28.587Z
Answers.UserDisplayName: a-am
Answers.Body: <p>You could set the <code>level</code> parameter according to your requirements:</p>
  
  <pre><code>{% set cats = craft.categories({
      relatedTo: {
          sourceElement: entry,
          field: 'categoryInput'
      },
      level: 2,
      limit: null
  }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T19:02:43.950Z
Answers.Text: Will this work if the input is part of a matrix?
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T19:09:33.137Z
Answers.Text: You would then need to set field to `myMatrixField.myCategoriesField`.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T19:13:56.020Z
Answers.Text: You pointed me in the correct direction.  Using level(2) off of the input works.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T19:22:11.863Z
Answers.Text: `entry.myCategoriesField` is actually just a shortcut for the full `craft.categories` criteria model I posted. So I'm surprised this solution doesn't work for you.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T19:38:05.487Z
Answers.Text: This does work but I figured there should be a quicker way than calling `craft.categories`.  When you wrote "set the level" I thought I would try using `level(2)` off of the input which worked. As you said it is returning a criteria model, which confused me as to why using `getDescendants` or `children` didn't work.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-28T18:49:38.080Z
Answers.LastActivityDate: 2015-10-28T18:49:38.080Z
Answers.UserDisplayName: carlcs
Body: <p>I have a category input. The category group has two levels. </p>
  
  <p><a href="https://i.sstatic.net/kUdoy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kUdoy.png" alt="enter image description here"></a></p>
  
  <p>When accessing the category input via Twig I am trying to only grab sub categories the user selected.  However when I use </p>
  
  <pre><code>{% set firstCat = entry.categoryInput.first %}
  {% set cats = firstCat.getDescendants() %}
  </code></pre>
  
  <p>or <code>children</code> it grabs all the descendants from <em>Categories > Group</em> not just from the structure that was selected from the input.  </p>
  
Tags: <templating><categories><elementcriteriamodel>
Title: Use only the sub categories from a category input
ThreadText: # Use only the sub categories from a category input
  
  (Asked by: username_0 on 2015-10-28)
  
  I have a category input. The category group has two levels.
  
  [![enter image description here](https://i.sstatic.net/kUdoy.png)](https://i.sstatic.net/kUdoy.png)
  
  When accessing the category input via Twig I am trying to only grab sub categories the user selected. However when I use
  
  ```
  {% set firstCat = entry.categoryInput.first %}
  {% set cats = firstCat.getDescendants() %}
  
  ```
  
  or `children` it grabs all the descendants from *Categories > Group* not just from the structure that was selected from the input.
  
  **Tags:** templating, categories, elementcriteriamodel
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-10-28. Score: 0 | Accepted answer
  
  @username_1 helped me stumble upon a solution. Using the `.level(2)` method gave the desired result.
  
  `{% set cats = entry.categoryInput.level(2) %}`
  
  
  ---
  
  ### Answer by username_1 on 2015-10-28. Score: 2
  
  You could set the `level` parameter according to your requirements:
  
  ```
  {% set cats = craft.categories({
      relatedTo: {
          sourceElement: entry,
          field: 'categoryInput'
      },
      level: 2,
      limit: null
  }) %}
  
  ```
  
  > **Comments:**
  > **username_0**: Will this work if the input is part of a matrix?  
  > **username_1**: You would then need to set field to `myMatrixField.myCategoriesField`.  
  > **username_0**: You pointed me in the correct direction.  Using level(2) off of the input works.  
  > **username_1**: `entry.myCategoriesField` is actually just a shortcut for the full `craft.categories` criteria model I posted. So I'm surprised this solution doesn't work for you.  
  > **username_0**: This does work but I figured there should be a quicker way than calling `craft.categories`.  When you wrote "set the level" I thought I would try using `level(2)` off of the input which worked. As you said it is returning a criteria model, which confused me as to why using `getDescendants` or `children` didn't work.  
  
  ---
  
  