Answers.Body: <p><code>drafts</code> is not a status but an <a href="https://github.com/craftcms/cms/blob/develop/src/elements/db/ElementQuery.php#L135-L139" rel="nofollow noreferrer">Element Query parameter</a> so if you want drafts to be return as well as live entries, you can do:</p>
  <pre class="lang-php prettyprint-override"><code>Event::on(
      \craft\fields\Entries::class,
      \craft\fields\Entries::EVENT_DEFINE_SELECTION_CRITERIA,
      function (\craft\events\ElementCriteriaEvent $e) {
          $e-&gt;criteria = ['drafts'=&gt; null];
      }
  );
  </code></pre>
  <p>Passing <code>true</code> would only return Drafts, <code>false</code> (default) no Drafts and <code>null</code> <em>takes it out</em> of the query.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-14T08:39:39.687Z
Answers.Text: Thanks, works perfectly! Unfortunately, while drafts now show up for selection, they're thrown out upon saving because the `BaseRelationField::normalizeValue` function doesn't allow drafts. I've opened [an issue on Github](https://github.com/craftcms/cms/issues/9963) about this – hopefully that leads somewhere, as it stands the only way to allow selecting drafts would be to extend the entries field and to modify the `normalizeValue` method to allow drafts.
Answers.UserDisplayName: MoritzLost
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-13T16:11:47.380Z
Answers.LastActivityDate: 2021-10-13T17:07:24.723Z
Answers.LastEditDate: 2021-10-13T17:07:24.723Z
Answers.UserDisplayName: Oli
Body: <p>Is it possible to allow selecting drafts in an entries field? Not drafts of an existing live entry, but drafts that aren't published yet.</p>
  <p>The only thing I found is an <code>ElementCriteriaEvent</code> <a href="https://github.com/craftcms/cms/blob/develop/src/fields/BaseRelationField.php#L1003-L1014" rel="nofollow noreferrer">triggered in the <code>BaseRelationField</code></a> class which allows you to add selection criteria for the field, but I couldn't figure out a way to change the allowable statuses using the criteria (by the way, is the syntax for those criteria arrays documented anywhere?).</p>
  <p>Here's my attempt which doesn't work:</p>
  <pre class="lang-php prettyprint-override"><code>use craft\events\ElementCriteriaEvent;
  use craft\fields\Entries;
  use yii\base\Event;
  
  Event::on(
      Entries::class,
      Entries::EVENT_DEFINE_SELECTION_CRITERIA,
      function (ElementCriteriaEvent $e) {
          $e-&gt;criteria = ['status' =&gt; ['live', 'draft']];
      }
  );
  </code></pre>
  
Tags: <relations><entries-field><draft>
Title: Allow drafts in entries field
ThreadText: # Allow drafts in entries field
  
  (Asked by: username_0 on 2021-10-13)
  
  Is it possible to allow selecting drafts in an entries field? Not drafts of an existing live entry, but drafts that aren't published yet.
  
  The only thing I found is an `ElementCriteriaEvent` [triggered in the `BaseRelationField`](https://github.com/craftcms/cms/blob/develop/src/fields/BaseRelationField.php#L1003-L1014) class which allows you to add selection criteria for the field, but I couldn't figure out a way to change the allowable statuses using the criteria (by the way, is the syntax for those criteria arrays documented anywhere?).
  
  Here's my attempt which doesn't work:
  
  ```php
  use craft\events\ElementCriteriaEvent;
  use craft\fields\Entries;
  use yii\base\Event;
  
  Event::on(
      Entries::class,
      Entries::EVENT_DEFINE_SELECTION_CRITERIA,
      function (ElementCriteriaEvent $e) {
          $e->criteria = ['status' => ['live', 'draft']];
      }
  );
  
  ```
  
  **Tags:** relations, entries-field, draft
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-10-13. Score: 2 | Accepted answer
  
  `drafts` is not a status but an [Element Query parameter](https://github.com/craftcms/cms/blob/develop/src/elements/db/ElementQuery.php#L135-L139) so if you want drafts to be return as well as live entries, you can do:
  
  ```php
  Event::on(
      \craft\fields\Entries::class,
      \craft\fields\Entries::EVENT_DEFINE_SELECTION_CRITERIA,
      function (\craft\events\ElementCriteriaEvent $e) {
          $e->criteria = ['drafts'=> null];
      }
  );
  
  ```
  
  Passing `true` would only return Drafts, `false` (default) no Drafts and `null` *takes it out* of the query.
  
  > **Comments:**
  > **username_0**: Thanks, works perfectly! Unfortunately, while drafts now show up for selection, they're thrown out upon saving because the `BaseRelationField::normalizeValue` function doesn't allow drafts. I've opened [an issue on Github](https://github.com/craftcms/cms/issues/9963) about this – hopefully that leads somewhere, as it stands the only way to allow selecting drafts would be to extend the entries field and to modify the `normalizeValue` method to allow drafts.  
  
  ---
  
  