How to add classes to Laravel 4 Forms

随声附和 提交于 2019-12-05 11:51:43

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/17284985/how-to-add-classes-to-laravel-4-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!