[Vuejs]-Laravel ignores validation errors and makes form disappear

0👍

You are trying to use Laravel like Javascript, which wont work.

Laravel will only process on the server which means on form submission it redirects to the server via a route and on error is redirected back to a fresh loaded page.

So when it returns it goes back to the initial fresh loaded state, and because you are dynamically calling the form to the page the server has rendered and found no need to output errors.

So the issue is not that Laravel has removed your form and not output errors, its how you are trying to implement it with dynamic pages.

There are a few options to try do what you want:-

You could add some logic to the page to look for an extra variable on redirect back which remembers the state, loads the forms and populates it with data and errors.

Do an AJAX call to the route to validate and use a javascript promise to update the form on screen.

Use something like Livewire.

Leave a comment