4 months ago

Select inputs ignored by validation

Posted 4 months ago by Chron

How can I tell laravel to include select inputs in validation?

<div class="col-md-3">
    <div class="form-group">
        <label for="sex">Sex</label>
        <div class="input-group">
            <select name="sex" id="sex" class="form-control">
                <option selected disabled value="">Male or Female? </option>
                <option value="Male">Male</option>
                <option value="Female">Female</option>
            @if ($errors->has('sex'))
                <span class="invalid-feedback" role="alert">
                    <strong>{{ $errors->first('sex') }}</strong>
$user = User::create(request()->validate([
    'sex' => ['required'],

Please sign in or create an account to participate in this conversation.