Reputation: 124
This line:
{{ Form::open(['action' => 'AnyController@hello', 'class'=> 'hello']) }}
Will result to:
<form method="POST" action="http://localhost:8000/hello" accept-charset="UTF-8" class="hello">
However, I wanted to add HTML5 custom data-* attribute, such:
<form method="POST" action="http://localhost:8000/hello" accept-charset="UTF-8" class="hello" data-abide>
How do I do that?
Thanks in advance!
Upvotes: 2
Views: 4463
Reputation: 158
Not sure if its a change in laravel, but
{{ Form::open(array(
'action' => 'AController@index',
'class' => 'hello',
'data-abide' => true
))
}}
results in
<form method="POST" action="http://localhost:8000/hello" accept-charset="UTF-8" class="hello" data-abide="1">
To get the the results you asked for use:
{{ Form::open(array(
'action' => 'AController@index',
'class' => 'hello',
'data-abide' => ''
))
}}
which results in
<form method="POST" action="http://localhost:8000/hello" accept-charset="UTF-8" class="hello" data-abide>
Upvotes: 4
Reputation: 14620
In Laravel 4 you can add custom attributes directly to the array.
{{ Form::open(array(
'action' => 'AController@index',
'class' => 'hello',
'data-abide' => true
))
}}
I am unsure whether Laravel will place in attributes that have no value via the Form
facade.
Upvotes: 1