Support the ongoing development of Laravel.io →
Requests Forms Validation
Last updated 6 months ago.
0

Put hidden fields on form 2 with the values from form 1, then when page 3 kicks you back to form 2 you get all the values back from withInput().

Last updated 6 months ago.
0

@thaifood I already have that. but the problem is actually the

else
{
    return Redirect::back()->withInput()->with('order', $session)->withErrors($validator);
}

Because of that it gives a redirect error

Last updated 6 months ago.
0
return Redirect::back()->withInput()->withErrors($validator);
Last updated 6 months ago.
0

@Eriktisme it gives a GET request, Tho I need a POST..

Last updated 6 months ago.
0

Did you ever figure this out. Im facing a similar issue?

0

I found this, having the same problem.
First I thought to separate the two posts, inserting an information page:

  1. Simple form (get)
  2. Presenting the result of the post (post)
  3. New page with a new post (get)
  4. Result of the second post (post)

In case of error submitting page 3, laravel goes back to page 3.

Then I followed another solution:

  1. Simple form (get)
  2. Analyze the submitted data and if success redirect to new get page (post)
    -> New page with a new post (get)
  3. Result of the second post (post)
  public function getIndex() {
    $input = Input::all();
    $validator = Validator::make($input, self::$startBooking);
    Session::put('order', $input);
    if($validator->passes()) {
      $value = Session::get('order');
      return redirect()->route('orderSummary', ['order' => $value]);
    } else {
      return Redirect::back()->withInput()->withErrors($validator);
    }
Last updated 5 years ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

reshadf reshadf Joined 4 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.