S
S
sp-megamen2018-05-16 13:06:43
Laravel
sp-megamen, 2018-05-16 13:06:43

How in laravel when checking the input to understand which form the errors belong to?

Hello,
I have a method that validates input from several similar forms that are located in several places on the same page.
I have a landing page with several call order forms (top, bottom, popup).
When an input error occurs, I need to display an error message exactly in the form where this error was made. You also need to fill in the fields of this particular form with the past values. And it will be very cool to scroll the page to the desired form.
What is the best way to organize this without using ajax?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2018-05-16
@sp-megamen

Add a hidden field to each form form_nameand old('form_name')check in the template that it is the current one.

I
iljaGolubev, 2018-05-16
@iljaGolubev

Make a hidden field with form id in each form.
In general, something is not properly organized: a strange question, a strange task.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question