# How to configure à Form?

**URL:** <https://discourse.getcockpit.com/t/how-to-configure-a-form/424>\
**Category:** Uncategorized\
**Created:** [November 28, 2018, 1:15pm UTC](https://discourse.getcockpit.com/t/how-to-configure-a-form/424 "2018-11-28T13:15:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nkondratek](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/nkondratek/32/170_2.png) [@nkondratek](https://discourse.getcockpit.com/u/nkondratek)\
**Post date:** [November 28, 2018, 1:15pm UTC](https://discourse.getcockpit.com/t/how-to-configure-a-form/424/1 "2018-11-28T13:15:59Z")

</div>

Hello,

Sorry if my question is very basic, but I don’t understand how to configure fields of au Form.

I try to create au contact form, and I want to add some fiels (name, subject, message, birthdate), but when I creat the form, I don’t see where I can add these fields :

 ![Screenshot%20at%202018-11-28%2014%3A07%3A05](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/1066f90bcbf9def69b919c644a8bbbe68926d7ef.png)

Can you help me ?  
Thanks you.

Nicolas.

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [November 28, 2018, 3:18pm UTC](https://discourse.getcockpit.com/t/how-to-configure-a-form/424/2 "2018-11-28T15:18:48Z")

</div>

You can’t do it with the core. Just send any fields and they will be saved.

The mailer only works if you add your mailer settings in config.yaml.

```auto
mailer:
    from : contactform@example.com
    from_name : MyApp
    transport : smtp
    host : smtphost.provider.com
    user : fancy-username
    password : SuperSavePassword
    port : 587
    auth : true
    encryption: starttls

```

If you want form fields, you can build something similar with a collection or use the [FormValidation addon](https://github.com/raffaelj/cockpit_FormValidation).

---

<div class="post-metadata">

**Author:** ![nkondratek](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/nkondratek/32/170_2.png) [@nkondratek](https://discourse.getcockpit.com/u/nkondratek)\
**Post date:** [December 2, 2018, 2:02pm UTC](https://discourse.getcockpit.com/t/how-to-configure-a-form/424/3 "2018-12-02T14:02:58Z")

</div>

Ok, I understand how to work Form feature, but, I have another question.

Is it possible to have a dynamic value for email in a form ?

Thanks you.  
Nicolas.

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [December 4, 2018, 5:21pm UTC](https://discourse.getcockpit.com/t/how-to-configure-a-form/424/4 "2018-12-04T17:21:27Z")

</div>

> [@nkondratek](#):
>
> Is it possible to have a dynamic value for email in a form ?

Not by default and not with the FormValidation addon (yet).

You could build a custom setup. Leave the mail field empty and add something like this to `config/bootstrap.php`

```php
$app->on('forms.submit.after', function($form, &$data, $frm){
    // your custom checks...

    try { // catch errror messages from mailer
        // send a custom mail
        $response = $this->app->mailer->mail($sendMyTo, $subject, $body, $options);
    } catch (\Exception $e) {
        $response = $e->getMessage();
    }
    // do something else
});

```

What is your goal?

---

<div class="post-metadata">

**Author:** ![nkondratek](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/nkondratek/32/170_2.png) [@nkondratek](https://discourse.getcockpit.com/u/nkondratek)\
**Post date:** [December 5, 2018, 10:33pm UTC](https://discourse.getcockpit.com/t/how-to-configure-a-form/424/5 "2018-12-05T22:33:27Z")

</div>

Thanks you for this answer. I go to try it.

Bye.  
Nicolas.
