Open jackperry opened 11 years ago
Try
{{ Form::open('login',array('method' => 'POST')) }}
In addition, if you have updated to the latest build of Laravel (composer update) the new form class should work with the way you have it (thats how it is working for me). I know a recent update of From class was updated to support the original syntax.
I tried that and it didn't work, but I made it empty ({{ Form::open() }}
) and it worked. However I'm sure this isn't a smart solution.
I am using the latest build of Laravel.
The syntax you are using works fine for me. Make sure your composer.json file has (otherwise I have found Form and Str classes are updated correctly)
"laravel/framework": "4.0.x-dev",
This code (snippet) works fine here
{{ Form::open('contacts.update','POST') }}
{{ Form::hidden('id', $contact->id) }}
{{ Form::hidden('page', Input::get('page')) }}
Ah, I was running "4.0.x" and not "4.0.x-dev", but I just changed it and did composer update
and {{ Form::open('login','POST') }}
still won't work. Same error.
Any chance you have Meido forms or PowerPacks installed?
I have powerpack installed yeah.
My guess it is conflicting since they both have same class names and method names. What features of PowerPacks do you need (use)? L4 latest pretty much has all that is in PowerPacks.
I installed PowerPacks for the HTML and Form classes. You're saying the latest Laravel 4 includes these now? Why was I getting the error before I switched to "4.0.x-dev" then, and I know HTML class wasn't found before I installed PowerPacks. Weird.
Yes indeed (they will be installed with the -dev build)
Look in the "vendor/laravel/framework/src/illuminate/Html/" directory
You should have both FormBuilder and HtmlBuilder classes (now that you have updated to -dev)
Interesting, however even after removing the PowerPack classes, the dev ones are producing the same error (must be of the type array), even though you said it supports the old method. Is my install borked or something? o_O;;
Did you do a composer update after removing PowerPacks from composer.json? I know it works (using it here no problem).
I did, yep. Removed PowerPacks from composer.json, removed the providers and aliases from app.php, and ran composer update.
So, the function declaration is as follows
public function open(array $options = array())
Not sure where the override is located?
So that tells me the following should work
{{ Form::open(array('action' => 'login', 'method' = 'POST' )) }}
Well, look at that! I still have PowerPacks installed so it appears that is what is actually being used as opposed to Laravel internal framework. That would explain why mine is still working.
Sorry to lead you astray... This whole time I thought I had completely removed PowerPacks but alas I have not (I am still using it for HTML class operations) When I removed PowerPacks myself it broke my app big time and I don't have time to fix all the places at the moment so I have reinstalled.
So, again this code should make it work for YOU (I will fix my code later)
{{ Form::open(array('action' => 'login', 'method' = 'POST' )) }}
Haha, well that explains things! Thanks!
On Sunday, March 10, 2013 at 8:20 PM, Mike Erickson wrote:
So, again this code should make it work for YOU (I will fix my code later) {{ Form::open(array('action' => 'login', 'method' = 'POST' )) }}
— Reply to this email directly or view it on GitHub (https://github.com/laravelbook/laravel4-powerpack/issues/9#issuecomment-14692821).
While I am new here I figured I would post how I got around this issue.
While the below throws and error: {{ Form::open('user/login', 'POST', array('id' => 'login-validate')) }}
If you just change the order and pou the extra options array first it works as expected. {{ Form::open(array('id' => 'login-validate'), 'user/login', 'POST') }}
Hope this helps.
The conflict is with Illuminate\Html\HtmlServiceProvider as it is trying to reference the Html for Illuminate instead of the HTML package included.
Once I commented out: Illuminate\Html\HtmlServiceProvider in the providers and 'Html' => 'Illuminate\Html\HtmlBuilder', in the aliases it worked as expected.
Hopes this helps with fixing this issue.
Regards, Ray
Or in the config/app.php, replace : 'Html' => 'Illuminate\Support\Facades\Html', by 'Html' => 'Illuminate\Support\Facades\HTML',
To avoid this problem, everything should be in camel case (URL => Url, DB => Db, HTML => Html, ...). Brief a single naming convention, not arbitrary as it is.
Hi, I think we had the same problem. I found out that you should indicate a url variable in an array on the first parameter. Shows like this,
{{ Form::open(array('url' => 'foo/bar')) }}
I hope this would help.
Hi, You can try this syntax, {{ Form::open(array('action' => 'login', 'method' => 'POST' )) }}
My form open line is currently: {{ Form::open(array('action' => 'login', 'method' = 'POST' )) }}
But it's returning this error:
Argument 1 passed to Illuminate\Html\FormBuilder::open() must be of the type array, string given, called in /opt/lampp/htdocs/lara/lp/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 211 and defined (View: /opt/lampp/htdocs/lara/lp/app/views/login.blade.php) Everything in the docs seems to be pointing to my Form::open line being correct, but I'm getting this. Ideas?
My form open line is currently:
{{ Form::open('login', 'POST') }}
But it's returning this error:
ErrorException: Catchable Fatal Error: Argument 1 passed to Illuminate\Html\FormBuilder::open() must be of the type array, string given, called in /Users/jack/Projects/x/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 138 and defined in /Users/jack/Projects/x/vendor/laravel/framework/src/Illuminate/Html/FormBuilder.php line 77
Everything in the docs seems to be pointing to my Form::open line being correct, but I'm getting this. Ideas?