Answers.Body: <p>The <code>fields</code> array may only contain names that represents handles in your <code>fieldLayout</code> but the <code>parent</code> attribute is a property of your object rather than a field - you can set it via <code>parentId</code>. You may want to inspect your CP form in order to see how you need to define attributes</p>
  
  <pre><code>&lt;section class="membersTitle" &gt;
      &lt;label&gt;Date&lt;/label&gt;
      &lt;select name="parentId"&gt;
          {% for entry in craft.entries.section('order').level(1).find() %}
              &lt;option value="{{ entry.id }}"&gt;{{ entry.title }}&lt;/option&gt;
          {% endfor %}
      &lt;/select&gt;
  &lt;/section&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-29T15:25:41.047Z
Answers.Text: thx Robin, so how I can add entry as a child, is it possible?
Answers.UserDisplayName: Alex Ryhluk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-29T15:26:28.497Z
Answers.Text: With the code above (?)
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-29T15:28:00.900Z
Answers.Text: if you know another way, tell me pls
Answers.UserDisplayName: Alex Ryhluk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-29T15:29:43.040Z
Answers.Text: There is no easier way.. Specify the `parentId` attribute and you are done. You can as well create a custom query to change all necessary columns by hand but just setting the parentId is the way to go
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-29T15:18:26.883Z
Answers.LastActivityDate: 2018-07-29T15:18:26.883Z
Answers.UserDisplayName: Robin Schambach
Body: <p>Form code:</p>
  
  <pre><code>&lt;section class="membersTitle" &gt;
      &lt;label&gt;Date&lt;/label&gt;
      &lt;select name="fields[parent][]"&gt;
      {% set entries = craft.entries.section('order').level(1) %}
          {% for entry in entries %}
              &lt;option value="{{ entry.id }}"&gt;{{ entry.title }}&lt;/option&gt;
          {% endfor %}
      &lt;/select&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>I want to choose Parent from list, and I want to add the element to parent.</p>
  
Tags: <structure>
Title: I try to add element to structure, and I want to add to this element parent ID
ThreadText: # I try to add element to structure, and I want to add to this element parent ID
  
  (Asked by: username_0 on 2018-07-29)
  
  Form code:
  
  ```
  <section class="membersTitle" >
      <label>Date</label>
      <select name="fields[parent][]">
      {% set entries = craft.entries.section('order').level(1) %}
          {% for entry in entries %}
              <option value="{{ entry.id }}">{{ entry.title }}</option>
          {% endfor %}
      </select>
  </section>
  
  ```
  
  I want to choose Parent from list, and I want to add the element to parent.
  
  **Tags:** structure
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-07-29. Score: 2
  
  The `fields` array may only contain names that represents handles in your `fieldLayout` but the `parent` attribute is a property of your object rather than a field - you can set it via `parentId`. You may want to inspect your CP form in order to see how you need to define attributes
  
  ```
  <section class="membersTitle" >
      <label>Date</label>
      <select name="parentId">
          {% for entry in craft.entries.section('order').level(1).find() %}
              <option value="{{ entry.id }}">{{ entry.title }}</option>
          {% endfor %}
      </select>
  </section>
  
  ```
  
  > **Comments:**
  > **username_0**: thx username_1, so how I can add entry as a child, is it possible?  
  > **username_1**: With the code above (?)  
  > **username_0**: if you know another way, tell me pls  
  > **username_1**: There is no easier way.. Specify the `parentId` attribute and you are done. You can as well create a custom query to change all necessary columns by hand but just setting the parentId is the way to go  
  
  ---
  
  