Support the ongoing development of Laravel.io →
Session Forms
Last updated 2 years ago.
0

Use {{Form::open}} instead

Last updated 2 years ago.
0

ksharifi said:

Use {{Form::open}} instead

I am using it, I just forgot to say that in my orginal post. it produces the same result, an empty hidden field. I'm not really sure what is going wrong with it.

Last updated 2 years ago.
0

CSRF token is stored in the session, check if the session store is well configured

Last updated 2 years ago.
0

The session is working fine with the database, but I also checked it with the session stored in a file and it doesn't work either way. I'm not really sure what to do, I can see the token in the session, but it will not display into the form unless I manually call csrf_token

Last updated 2 years ago.
0

Have you tried a fresh laravel copy ?

Last updated 2 years ago.
0

I just did and the token works, now i need to figure out what I did to break it :/

Last updated 2 years ago.
0

I'm not sure what to do anymore, I disabled all packages and and tried reverting as much back to default and possible thinking that maybe it was a third part addon. Any ideas what could be causing this or how to rectify it?

Last updated 2 years ago.
0

Fixed it. I had form macro's in a file that I was including in bootstrap/start.php. It was causing the errror, as soon as I removed it the tokens started working perfectly.

Last updated 2 years ago.
0

I'm having this same issue with Laravel 4.2 (empty valued inputs for CSRF tokens when defining form macros in bootstrap/start.php), but I'd like to keep my macros.

I noticed this problem occurs because the definition of the macros force the FormBuilder to be created before the session is initialized, and since the session is not initialized until the $app->run() call in public/index.php I can't find the right place to define my form macros.

Are form macros and the CSRF filter exclusive?

Thanks.

Last updated 2 years ago.
0

Instead of using Form::macro I used HTML::macro, which I hadn't seen in the documentation. This was an option for my case, but I believe my last question still remains:

Does anybody know if form macros and the CSRF filter are exclusive/incompatible?

Thanks.

Last updated 2 years ago.
0

I had this issue on Laravel 5.2 and fixed it by placing my routes inside a "web" middleware group like this:

Route::group(['middleware' => ['web']], function () {

    // Put your routes inside here

});

A complete explanation of what worked for me is at http://stackoverflow.com/questions/34422751/why-is-my-csrf-token-empty-when-using-formopen

0

Sign in to participate in this thread!

Eventy

Your banner here too?

jcloutz jcloutz Joined 11 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.