# Forms

# What are the default forms in the account area?

<table border="1" id="bkmrk-class-route-descript" style="border-collapse: collapse; width: 100%; height: 238.375px;"><colgroup><col style="width: 50.0596%;"></col><col style="width: 50.0596%;"></col></colgroup><tbody><tr style="height: 29.7969px;"><td style="height: 29.7969px;">**Class**  
</td><td style="height: 29.7969px;">**Description**  
</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountAddressEditForm`</td><td style="height: 29.7969px;">The edit address form.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountAddressNewForm`</td><td style="height: 29.7969px;">The new address form.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountDetailsForm`</td><td style="height: 29.7969px;">The account details form.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountLoginForm`</td><td style="height: 29.7969px;">The login form.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountPasswordForgotForm`</td><td style="height: 29.7969px;">The forgotten password form.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountPasswordResetForm`</td><td style="height: 29.7969px;">The password reset form.</td></tr><tr style="height: 29.7969px;"><td style="height: 29.7969px;">`AccountRegisterForm`</td><td style="height: 29.7969px;">The register form.</td></tr></tbody></table>

<p class="callout info">The above classes reside in the `Aero\AccountArea\Http\Forms` namespace.</p>

# How do I create a custom form in the account area?

To create a form you need to create a class that extends the `\Aero\AccountArea\AccountAreaForm` class:

- The `$sections` array lists the views used to render the form.
- The `method()` method defines the method that the form will use (this should be `post`, `get`, `put`, or `delete`).
- The `route()` method should return the URL for the form. 
    - A `$data` variable is accessible in case the route requires parameters that are available in the data.

For example, here's how the login form is defined:

```php
class LoginForm extends \Aero\AccountArea\AccountAreaForm
{
    protected $sections = [
        'email' => 'account-area::partials.email-input',
        'password' => 'account-area::partials.password-input',
        'forgot-password' => 'account-area::partials.login-forgot-password-link',
        'submit' => 'account-area::partials.login-button',
    ];

    protected function method(): string
    {
        return 'post';
    }

    protected function route($data): string
    {
        return route('login');
    }
}
```

Don't forget to register your form:

```php
\Aero\AccountArea\AccountArea::registerForm(MyForm::class);
```