Page 1 of 1

Validation for request input field

Posted: 16 May 2022, 19:26
by ahmed31916
Hello,

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

Re: Validation for request input field

Posted: 18 May 2022, 06:25
by aimeos
Where do you want to add a validation? In the address page of the checkout it's built in for example.

Re: Validation for request input field

Posted: 18 May 2022, 20:32
by ahmed31916
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.

Re: Validation for request input field

Posted: 19 May 2022, 06:53
by aimeos
You can use the Laravel validation or you can implement it in your HTML client class yourself.

Re: Validation for request input field

Posted: 19 May 2022, 20:31
by ahmed31916
How we can display validation errors in template class?
In a blade syntax we use "@error" or {{$errors}}, but in template we cannot!

Re: Validation for request input field

Posted: 20 May 2022, 09:23
by aimeos
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' ) ?>"