简体   繁体   中英

Laravel: post form without validation

I'm in trouble with Laravel framework. I have two forms, but they do the same thing: signup.

Here's a deal. I have a signup page. I also have a signup form on my home page. When I fill form on my home page and click "Sign up", it's validate my form. I don't want it. I want it to redirect POST to /signup and then validate. I want to display error/success info on /signup page. How can I do this?

my form on home.blade.php (signup.blade.php has the same form):

<form action="{{ route(auth.signup) }}" method="POST">
<input name="username" type="text" placeholder="Username">
<input name="email" type="email" placeholder="Email">
<input name="password" type="password" placeholder="Password">
<input name="password_confirmation" type="password" placeholder="Confirm Password">
<input type="submit" value="Sign up">

Is not what you are asking but I would do an "ajax registration" in your home page and show the proper validation error in your home page. If you need to have both singups (home, fullpage) you can differentiate your post request doing this on your auth.singup:

if ( $request->ajax() ){
      return response()->json([
          'auth' => $auth, // Your validation result
          'intended' => URL::previous()
      ]);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM