# Not all fields showing in received email form (Uniform)

**URL:** <https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322>\
**Category:** Plugins\
**Created:** [May 17, 2021, 3:00am UTC](https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322 "2021-05-17T03:00:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiahr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/kiahr/32/7169_2.png) [@kiahr](https://forum.getkirby.com/u/kiahr)\
**Post date:** [May 17, 2021, 3:00am UTC](https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322/1 "2021-05-17T03:00:19Z")

</div>

Hello,

I am using Uniform for an AJAX form.

When the form is received via email, the “Email” submitted in the input by the user is not included.

The route looks like:

```
'routes' => [

[
  'pattern' => '(:all)',
  'method' => 'POST',
  'action' => function () {
      $form = new \Uniform\Form([
          'name' => [],
          'email' => [
              'rules' => ['required', 'email'],
              'message' => 'Please enter a valid email address',
          ],
          'message' => [
              'rules' => ['required'],
              'message' => 'Please enter a message',
          ],
      ]);

      // Perform validation and execute guards.
      $form->withoutFlashing()
          ->withoutRedirect()
          ->guard();

      if (!$form->success()) {
          // Return validation errors.
          return Response::json($form->errors(), 400);
      }

      // If validation and guards passed, execute the action.
      $form->emailAction([
          'to' => 'emailaddress@gmail.com',
          'from' => 'form@website.com',
      ]);

      if (!$form->success()) {
          // This should not happen and is our fault.
          return Response::json($form->errors(), 500);
      }

      // Return code 200 on success.
      return Response::json([], 200);
  }
  ]
]

```

The form is:

```
<form class="form__contact" action="<?= $page->url() ?>" method="POST">
    <input name="name" placeholder="Name" type="text">
    <input name="email" placeholder="Email" type="email">
    <div class="textarea__wrapper">
        <textarea placeholder="Message" name="message"></textarea>
    </div>

    <?php echo csrf_field() ?>
    <?php echo honeypot_field() ?>
    <p id="message"></p>
    <input type="submit" value="Submit">
</form>

```

My understanding is that Uniform’s default template will grab and display each $field and $value however when I receive the email it is just:

Name: _Inputted Name_

Message: _Inputted Message_

🤔 Any ideas @mzur ? I am sure I am just missing something very simple

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 17, 2021, 6:36am UTC](https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322/2 "2021-05-17T06:36:40Z")

</div>

The email key is unset here for the body data: [kirby-uniform/EmailAction.php at bfd1464c8e135b06200ed928f6bf571df3578310 · mzur/kirby-uniform · GitHub](https://github.com/mzur/kirby-uniform/blob/bfd1464c8e135b06200ed928f6bf571df3578310/src/Actions/EmailAction.php#L127)

---

<div class="post-metadata">

**Author:** ![kiahr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/kiahr/32/7169_2.png) [@kiahr](https://forum.getkirby.com/u/kiahr)\
**Post date:** [May 17, 2021, 7:02am UTC](https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322/3 "2021-05-17T07:02:08Z")

</div>

Ohh… thanks for pointing that out.

I could of course remove that line (so it is not unset), but is there another more elegant way so I do not change the plugin files, do you know?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 17, 2021, 7:07am UTC](https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322/4 "2021-05-17T07:07:08Z")

</div>

Quick guess, put it the array of data you send with your email, with a different key:

```auto
$form->emailAction([
          'to' => 'emailaddress@gmail.com',
          'from' => 'form@website.com',
          'data' => [
             'myemailkey' => esc($_POST['email']),
      ]);

```

---

<div class="post-metadata">

**Author:** ![mzur](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mzur](https://forum.getkirby.com/u/mzur)\
**Post date:** [May 17, 2021, 12:06pm UTC](https://forum.getkirby.com/t/not-all-fields-showing-in-received-email-form-uniform/22322/5 "2021-05-17T12:06:32Z")

</div>

You could also use the `emails/uniform-default` [email template](https://kirby-uniform.readthedocs.io/en/latest/actions/email/#template_1) which includes all form fields.
