Skip to content
Advertisement

laravel validation system stop the insertion even the field is hidden by jQuery

in a form I have a select category which allows you to hide or show the inputs according to type to select in select category. this form is to insert an advertisement either title or name use validation system, when I click on button insertion, validation system check other value even it is hidden by jQuery, then it stops the insertion how solved this problem.

create.blade.php

JavaScript

jQuery

JavaScript

AdsController.php

JavaScript

Advertisement

Answer

Hiding elements via CSS doesn’t remove them from the DOM. So the fields will be submitted even if they aren’t visible.

Try something like this instead:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement