Validation for request input field

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Validation for request input field

Post by ahmed31916 » 16 May 2022, 19:26

Hello,

How could we make a validation for an input field and display the error message inside the template page?

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Validation for request input field

Post by aimeos » 18 May 2022, 06:25

Where do you want to add a validation? In the address page of the checkout it's built in for example.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: Validation for request input field

Post by ahmed31916 » 18 May 2022, 20:32

I made a form in the profile page that makes the merchant user (just merchants) to add a product. I made it but it remain the validation for the input.

I use laravel validation request and I display the errors by ajax, and everything works. But I wonder if there is already created in aimeos.

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Validation for request input field

Post by aimeos » 19 May 2022, 06:53

You can use the Laravel validation or you can implement it in your HTML client class yourself.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Re: Validation for request input field

Post by ahmed31916 » 19 May 2022, 20:31

How we can display validation errors in template class?
In a blade syntax we use "@error" or {{$errors}}, but in template we cannot!

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Validation for request input field

Post by aimeos » 20 May 2022, 09:23

If you store the errors in a view variable named e.g. "$view->error = '...'", you can access it in your template using "<?= $this->get( 'error' ) ?>"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply