I can't find a way to get Laravel to highlight the correct field when a _confirmation field is incorrect.
Using a Bootstrap layout I've got an email and email_confirmation field in my form like this:
<div class="control-group {{$errors->has('email') ? 'error' : ''}}">
{{ Form::label('email', 'Email', array('class' => 'control-label'))}}
<div class="controls">
{{ Form::email('email', Input::old('email'));}}
{{ $errors->first('email', Form::block_help(':message')) }}
</div>
</div>
<div class="control-group {{$errors->has('email_confirmation') ? 'error' : ''}}">
{{ Form::label('email_confirmation', 'Confirm Email', array('class' => 'control-label'))}}
<div class="controls">
{{ Form::email('email_confirmation', Input::old('email_confirmation'));}}
{{ $errors->first('email_confirmation', Form::block_help(':message')) }}
</div>
</div>
So if the user puts in an invalid email address then the 'email' field will have an error attached to it and the correct label/field will be highlighted.
But if the user has entered a valid/correct email address in the first field but gets the confirmation wrong - the error returned is still for the 'email' field, not the email_confirmed field.
To me it looks weird when the email field is highlighted when the error is actually with the email_confirmation field.
As far as I can understand from this stackoverflow question, I could probably do something like
{{$errors->first('email', ':message') == 'Please confirm your email address correctly.' ? 'error' : ''}}
This will work, but the problem is that I'm running a multi-lingual site so the :message that gets returned is going to be one of many possibilities.
I guess I could write a function to compare the :message against an array of messages for each language but I thought I'd check if there was an easier way to go about it.
Cheers!