Reputation: 4166
when I search in Laravel 4 API, ex:
Form::open(array $options = array())
I can't find full list of available options? where to find it?
http://laravel.com/api/4.1/Illuminate/Html/FormBuilder.html#method_open
thanks,
Upvotes: 0
Views: 981
Reputation: 9847
The options are:
action='...'
attribute. If there is also a url
, route
option, they will be translated into the appropriate URL. Otherwise, the action
should point to a Controller action route. If not present, the action defaults to current URL.true
if file upload is present, appends enctype = 'multipart/form-data'
to the form.toghether with any option you wish to add (like "id", "enctype" or similar).
Upvotes: 1
Reputation: 1411
The list of options is the same list of form without use php:
http://www.w3schools.com/tags/tag_form.asp
The difference is that the attributes will be passed in array format:
array('action' => 'user.update', 'enctype' => 'multipart/form-data', 'method' => 'PUT')
The default method is POST, if not especified.
@edit
Seems that i didn't let clear.
Laravel only include some atributes to help, how url(converted to action), route(converted to action), file(converted to enctype='multipart/form-data'), but yet same thing.
file to enctype conversion:
if (isset($options['files']) && $options['files'])
{
$options['enctype'] = 'multipart/form-data';
}
Upvotes: 0
Reputation: 468
See below link for specific options namely method
,action
,files
,url
and route
http://laravel.com/api/source-class-Illuminate.Html.FormBuilder.html#63
Their usage is explained here
http://laravel.com/docs/html#opening-a-form
And you can add any other attributes you use in HTML as options, too.
Upvotes: 1
Reputation: 1608
Take a look at the source code: https://github.com/laravel/framework/blob/master/src/Illuminate/Html/FormBuilder.php#L95
Some complicated form:
Form::open(['method' => 'put', 'action' => 'awesomeController@putForm', 'id' => 'my-id', 'class' => 'some more css classes', 'files' => 'true', 'data-url' => 'This could be read in JavaScript']);
method
, action
and files
are specific to Laravel, the other values are just attributes and values.
Upvotes: 0