Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding classes/ids to forms in Laravel 4

Tags:

I am trying to add classes and ids to specific elements of a form in Laravel 4. For example, I would like this:

<textarea type="text" id="description" onfocus="this.value=''; setbg('#f0f7f8');" onblur="setbg('white')" name="description" value="" rows="10"></textarea>

to be applied to:

{{ Form::label('description', 'Description:') }}
{{ Form::textarea('description')}}

I didn't see this in the documentation. Thank you!

like image 330
user1072337 Avatar asked Jun 24 '13 21:06

user1072337


1 Answers

Use the third parameter for the Form::textarea method, passing a key-value array. Ex:

Form::textarea('description', null, [
    'id'      => 'description',
    'rows'    => 10,
]);
like image 146
rmobis Avatar answered Oct 13 '22 13:10

rmobis