Support the ongoing development of Laravel.io →
Views Forms Validation

So I have two forms on a single page. Login (email, password) and register (username, email, password). If I fill email on login form and click login, it displays the appropriate error message, but also fills the registration form email input and displays an error for password. Same applies for reverse.

What would be the best solution for this aside from the obvious one to create different pages for login and registration

Last updated 2 years ago.
0

Rename input names? For example: <input type="email" name="login_email"> and <input type="email" name="register_email">

Last updated 2 years ago.
0

Yes, but Eloquent would than look for login_email field in DB, which I don't have. Maybe there's a way around that?

I guess I could rename the fields in controller but that just creates an extra step and would probably ruin the $errors, since login_email wouldn't exist anymore.

My current solution is to just output a flash message without the errors.

Last updated 2 years ago.
0

You can set the column name on the rules example $rules = ['login_email' => 'unique:users,email'];

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

pogachar pogachar Joined 26 Jul 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.

© 2025 Laravel.io - All rights reserved.