I am trying to display a bootstrap formatted form bound to my User model. However, the form-model binding seems to only work out when I use input fields that are not formatted with bootstrap styles.
Here is one without the bootstrap class, which perfectly displays what I have in my db when I open my form with:
{{ Form::model($user) }}
{{ Form::label('name', 'Vorname:')}}
{{ Form::text('name')}}
Here is the second input of this form, now with the bootstrap class. This one does not display the db content.
{{ Form::label('sirname', 'Nachname:')}}
{{ Form::text('sirname', '', array('class'=>'form-control'))}}
How can I fix this? Is there a way to use form-model binding and styling the inputs with bootstrap classes at the same time?
Any help would be appreciated.
Thanks!
Try the following:
{{ Form::model($user, array('route' => 'xyz')) }}
{{ Form::label('name', 'Vorname:')}}
{{ Form::text('name', null, array('class' => 'form-control'))}}
{{ Form::label('sirname', 'Nachname:')}}
{{ Form::text('sirname', null, array('class' => 'form-control')) }}
{{ Form::close() }}
if you use form model, do not forget to close it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With