# Form validation in Shopware 6 administration

**URL:** https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658
**Category:** Programming (EN)
**Created:** [21. März 2020 um 11:43 UTC](https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658 "2020-03-21T11:43:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Pieter](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@Pieter](https://forum.shopware.com/u/Pieter)
#### Post date: [21. März 2020 um 11:43 UTC](https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658/1 "2020-03-21T11:43:06Z")

</div>

Does anybody know&nbsp;of a good tutorial on how to implement form validation in&nbsp;a custom module&nbsp;in the Shopware 6 administration? The “how to’s” that I found go into the details of crud actions, but without any reference to validations. As a newbe to Shopware 6 programming, the existing Shopware 6 administration modules unfortunately are a bridge too far at this point in my learning curve ;-)&nbsp;

Thanks for your help!

---

<div class="post-metadata">

### Author: ![Rakowu](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@Rakowu](https://forum.shopware.com/u/Rakowu)
#### Post date: [23. April 2020 um 06:02 UTC](https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658/2 "2020-04-23T06:02:56Z")

</div>

Hi, could you get a solution for that problem? I run into the same issue

---

<div class="post-metadata">

### Author: ![ShapeAndShift](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@ShapeAndShift](https://forum.shopware.com/u/ShapeAndShift)
#### Post date: [23. April 2020 um 06:30 UTC](https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658/3 "2020-04-23T06:30:51Z")

</div>

The validation currently pretty sucks.&nbsp;

Anyway just take a look at mapApiErrors and you get the idea.

[https://github.com/shopware/platform/blob/4bdbc9238e57f6cd3e33fc97a16aaa1e5d19d15a/src/Administration/Resources/app/administration/src/app/component/rule/condition-type/sw-condition-line-item-custom-field/index.js#L5](https://github.com/shopware/platform/blob/4bdbc9238e57f6cd3e33fc97a16aaa1e5d19d15a/src/Administration/Resources/app/administration/src/app/component/rule/condition-type/sw-condition-line-item-custom-field/index.js#L5)

or better&nbsp;mapPropertyErrors&nbsp;&nbsp;

[https://github.com/shopware/platform/blob/87fc9e8cf4cdab0650e0caaf9a8ba12bab2902c2/src/Administration/Resources/app/administration/src/module/sw-customer/component/sw-customer-address-form/index.js](https://github.com/shopware/platform/blob/87fc9e8cf4cdab0650e0caaf9a8ba12bab2902c2/src/Administration/Resources/app/administration/src/module/sw-customer/component/sw-customer-address-form/index.js)

Don’t forget to add a Required flag within your Entity etc.

---

<div class="post-metadata">

### Author: ![Pieter](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@Pieter](https://forum.shopware.com/u/Pieter)
#### Post date: [23. April 2020 um 11:25 UTC](https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658/4 "2020-04-23T11:25:49Z")

</div>

Thanks ShapeAndShift,

This brought me one step closer to implementing form validations in the backend. I do wonder though how to tie&nbsp;the validations into an entity’s API. Take customer as an example:

I see a lot of validation factories in&nbsp;[platform/src/Core/Checkout/Customer/Validation at 4bdbc9238e57f6cd3e33fc97a16aaa1e5d19d15a · shopware/platform · GitHub](https://github.com/shopware/platform/tree/4bdbc9238e57f6cd3e33fc97a16aaa1e5d19d15a/src/Core/Checkout/Customer/Validation) which are injected through&nbsp;[platform/customer.xml at 4bdbc9238e57f6cd3e33fc97a16aaa1e5d19d15a · shopware/platform · GitHub](https://github.com/shopware/platform/blob/4bdbc9238e57f6cd3e33fc97a16aaa1e5d19d15a/src/Core/Checkout/DependencyInjection/customer.xml)

(BTW it looks like this has changed from my SW6 developer version, which defines e.g. an account service in customer.xml that mentions a validation factory).

A tutorial that describes what I need to define where in this context&nbsp;as per the latest SW6&nbsp;programming guidelines would really help!

Thanks,&nbsp;Pieter

---

<div class="post-metadata">

### Author: ![rammi22](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rammi22](https://forum.shopware.com/u/rammi22)
#### Post date: [31. Juli 2020 um 06:11 UTC](https://forum.shopware.com/t/form-validation-in-shopware-6-administration/65658/5 "2020-07-31T06:11:22Z")

</div>

> [@Pieter schrieb:](https://forum.shopware.com/profile/34545/Pieter "Pieter")
> 
> …
> 
> A tutorial that describes what I need to define where in this context&nbsp;as per the latest SW6&nbsp;programming guidelines would really help!
> 
> Thanks,&nbsp;Pieter

Hi, is there meanwhile a tutorial available?
