I'm trying to add error display class to my laravel form field
My form:
{!! Form::open(array('route' => 'users.store','method'=>'POST')) !!}
<div class="container mt-3">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<strong>First Name:</strong>
{!! Form::text('name', null, array('placeholder' => 'First Name','class' => 'form-control @error('name') is-invalid @enderror')) !!}
@error('name')
<span class="invalid-feedback" role="alert">
<strong></strong>
</span>
@enderror
</div>
</div>
</div>
{!! Form::close() !!}
The form was working fine until I changed the filed class to
'class' => 'form-control @error('name') is-invalid @enderror'
as I needed to display the error message under the input field.
But when I run the application it gives me an error saying,
syntax error, unexpected 'name' (T_STRING), expecting ')'
So What I'm doing wrong and how can I fix that?
Also
How can I set old value correctly in that field??
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire