I am Kingsley Okpara, a Python and PHP Fullstack Web developer and tech writer, I also have extensive knowledge and experience with JavaScript while working on applications developed with VueJs.
Laravel validator is not working inside the modal.
how to make it work? while inputting blank values it will just refresh the page after submit button.
blade
@if ($errors->any())
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
Probably a bit late, but if it doesn't help you it might still be useful for other people. I think you are mixing two approaches:
First, you can submit a form by sending a POST request to the server, and the server will then redirect you to a new page. In that case you can use the $errors directive to catch anything that went wrong during validation.
When using a modal, you submit your data using AJAX. This means you basically never leave the page you are on. The server will still return a response, but you have to process this in your JavaScript (specifically, in the AJAX error callback function).
How to make the validation work inside your modal?
which kind of validation are you talking about?
Laravel validator is not working inside the modal.
how to make it work? while inputting blank values it will just refresh the page after submit button.
blade
controller
Look when I erase the input values and submit the form again it won't show the error messages for laravel validator
dev-to-uploads.s3.amazonaws.com/i/...
Probably a bit late, but if it doesn't help you it might still be useful for other people. I think you are mixing two approaches:
First, you can submit a form by sending a POST request to the server, and the server will then redirect you to a new page. In that case you can use the $errors directive to catch anything that went wrong during validation.
When using a modal, you submit your data using AJAX. This means you basically never leave the page you are on. The server will still return a response, but you have to process this in your JavaScript (specifically, in the AJAX error callback function).
You can find more info here: stackoverflow.com/questions/493337...