So I have fields that are to be hidden if it met certain conditions. And now I'm having problem in my validation. Here's what I have:
blade.php
<div class="">
<div class="form-group check-in-dtls">
<label for="before_checkin">@lang('before_checkin')</label>
<input type="text" class="form-control" id="before_checkin" name="before_checkin" placeholder="@lang('before_checkin')" value="">
@if ($errors->has('before_checkin'))
<div class="form-group">
<p class="text-danger"></p>
</div>
@endif
</div>
</div>
validation file
'before_checkin' => ['sometimes', 'required', 'max:255'],
css
.hide-fields{
display: none;
}
I would like the fields to be required only if it is shown and my validation is not working well. For this one, what is the best approach to do?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire