3

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.

Brad Bell
  • 67,440
  • 6
  • 73
  • 143

1 Answers1

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>
Robin Schambach
  • 19,713
  • 1
  • 19
  • 44