Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add classes to Laravel 4 Forms

Probably, it is a simple answer but I cannot find any documentation regarding this. I have laid out a form using Laravel 4 and it seems to be working fine but now I need to style it. How can I add classes to the form when its using blade?

 {{ Form::open(array('url' => 'foo/bar')) }}

I have a class set up for the form and the buttons but I am not sure how to add it to the blade template.

like image 644
Lynx Avatar asked Jun 24 '13 20:06

Lynx


2 Answers

You may try this

{{ Form::open(array('url' => url('foo/bar'), 'class'=>'form', 'id'=>'frmFoo', 'style'=>'border:solid gray 1px')) }}

You can add inline style, class, id etc.

like image 77
The Alpha Avatar answered Oct 15 '22 11:10

The Alpha


As far as I know, you can easily pass additional attributes to the open() methods argument:

echo Form::open(array('url' => 'foo/bar', 'method' => 'put', 'class' => 'form-bootstrap'))

Check out the L4 docs for more information http://laravel.com/docs/html

like image 7
Remluben Avatar answered Oct 15 '22 12:10

Remluben