For the problem below consider that I'm using Laravel (5.6 * with style files and default javascript (no changes).
My problem is basically when trying to display the validation message of the radio (id: gender) field group, these are grouped in a fieldset . The validation occurs and in the HTML (DOM) returned with you to see the present message, however, it is not being displayed on the screen.
Controller:
$this->validate($request, [
'name' => 'required|min:3',
'profissao' => 'min:3',
'biografia' => 'min:20',
'genero' => 'required|in:F,M,Não declarado',
'data_nascimento' => 'required'
]);
//...
View:
@if (session('status'))
<div class="alert alert-{{ session('status') }}">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
{{ session('msg') }}
</div>
@endif
<!-- //... -->
<div class="form-group row">
<label for="genero" class="col-md-4 col-form-label text-md-right">Gênero</label>
<div class="col-md-6">
<fieldset id="genero">
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input{{ $errors->has('genero') ? ' is-invalid' : '' }}" name="genero" value="F" {{ $usuario->genero == 'F' ? 'checked' : '' }}>
Feminino
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input{{ $errors->has('genero') ? ' is-invalid' : '' }}" name="genero" value="M" {{ $usuario->genero == 'M' ? 'checked' : '' }}>
Masculino
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="radio" class="form-check-input{{ $errors->has('genero') ? ' is-invalid' : '' }}" name="genero" value="Não declarado" {{ $usuario->genero == 'Não declarado' ? 'checked' : '' }}>
Não declarado
</label>
</div>
</fieldset>
@if ($errors->has('genero'))
<span class="invalid-feedback">
<strong>{{ $errors->first('genero') }}</strong>
</span>
@endif
</div>
</div>