C
C
cron2018-07-24 15:30:27
JavaScript
cron, 2018-07-24 15:30:27

How to correctly parse response with form errors in laravel?

Hello, I'm making a frontend for laravel.
I have dynamically created fields:
5b571a5db1580906885670.png
There is an unlimited number of rows, each of which has room_id and name
fields. The fields are validated as follows:

$validationRules['related.'. $key . '.room_id'] = ['required'];
$validationRules['related.'. $key . '.name'] = ['required'];

In response, I get an array of errors like this:
5b571a4998e07025840979.png
Tell me, is there a ready-made function in js that would overtake these tree-like errors into something more digestible?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vism, 2018-07-24
@cron

Just convert from dot notation to normal and return

D
Dmitry Kuznetsov, 2018-07-24
@dima9595

You can specify custom values ​​in the translation file. Perhaps this will help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question