I've got a select list in a form
<div class="form-group {!! $errors->has('primenom') ? 'has-error' : '' !!}">
{!! Form::label('user_id', 'Selectionner l\'utilisateur : ', ['class' => 'control-label']) !!}
{!! Form::select('user_id', array_merge(['0' => 'Selectionnez l\' utilisateur'], $usersList->ToArray() ), 'Selectionnez l\' utilisateur', ['class' => 'form-control']) !!}
{!! $errors->first('user_id', '<small class="help-block">:message</small>') !!}
</div>
I've builded a specific request class with these rules :
public function rules()
{
return [
'user_id' => 'regex:[?/! ^(Selectionner l\'utilisateur)]',
'primenom' => 'required|numeric',
'primevalue' => 'required|numeric',
];
}
I've tried to test if the end user has change the default value "selectionner votre utilisateur" with a real value which is content in the $usersList->toArray();
I try with a regex exclusion, but I think I'm a regex loser ;)
PS: I'm french so excuse me for my english ;)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community