Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

{"error”:true,"error_msg”:"Invalid Form Key"}
 
tommix
Jr. Member
 
Total Posts:  24
Joined:  2008-12-05
 
Pixxa - 30 December 2008 09:47 AM

Tried the above, nothing changed.. still invalid Form Key error when entering Manage Catagories.

do not forget to clear all cache from magento and from browser.

 
Magento Community Magento Community
Magento Community
Magento Community
 
thomasmore
Sr. Member
 
Total Posts:  80
Joined:  2008-10-21
 

I tried everything mentioned here and nothing worked. Just gonna revert back to 1.1.8.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MeowMeowKK
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2009-01-19
Colchester, Essex, UK
 
jemoon - 03 January 2009 06:18 PM

Hi,
Finally I have found a reasonable solution. It just requires to edit one line in /app/design/adminhtml/default/default/template/page/head.phtml - change:

var FORM_KEY '<?php echo $this->getFormKey() ?>';
for this:
var FORM_KEY '<?php echo Mage::getSingleton('core/session')->getFormKey() ?>';
I know that it should be done in other, more convienient way but I think that it’s good for now.

FANTASTIC! THIS WORKS!!! THANK YOU! I’m not worthy!

:D

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tonyo
Jr. Member
 
Total Posts:  15
Joined:  2007-10-24
Conwy N.Wales
 

Hi Everyone

Can we re-visit this ‘var FORM_KEY’ issue.
This problem has only existed since upgrading from 1.8. Am now at ver. 1.2.0.2 but all the fixes in this post have not been any help.
Has anyone manage to resolve this but maybe forgot to report a fix here or maybe you think your fix is so unimportant you think noone could ever possibly interested in your findings.
Well, I would be very interested to know how you have fixed this.
My problem is that when I visit the products page through the back end and then use the pagination to scroll to the next page I get the ‘var FORM_KEY’ issue. It also appears when I filter my searches on products.

Your help and thoughts are appreciated.

regards Tony

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

@jemoon - thanks for looking into our extension. I’ve uploaded a new version which incorporates the new function.

@Tonyo - have you seen this wiki entry:

http://www.magentocommerce.com/wiki/upgrading_magento_themes_for_the_latest_releases#magento_1.1.7_1.1.8_to_1.2_theme_changes

When I upgraded I went through each file listed to check if I had used it in my own customised theme (which extends the default theme) and then compared what happened between version 1.1.8 and 1.2. I then applied these changes to my theme. A laborious process but it works.

If you are having issues with the form_key in the frontend you will be particularly interested in these files:
template/customer/address/edit.phtml
template/customer/form/edit.phtml
template/customer/form/newsletter.phtml
template/wishlist/sharing.phtml
template/wishlist/view.phtml

In short you need to add

<?php echo $this->getBlockHtml('formkey')?>
Inside the form elements.

Good luck

 
Magento Community Magento Community
Magento Community
Magento Community
 
apasquale
Jr. Member
 
Total Posts:  4
Joined:  2008-11-04
 

Jemoon’s fix works for me:

jemoon - 03 January 2009 06:18 PM

Hi,
Finally I have found a reasonable solution. It just requires to edit one line in /app/design/adminhtml/default/default/template/page/head.phtml - change:

var FORM_KEY '<?php echo $this->getFormKey() ?>';
for this:
var FORM_KEY '<?php echo Mage::getSingleton('core/session')->getFormKey() ?>';
I know that it should be done in other, more convienient way but I think that it’s good for now.

But make sure you refresh your cache afterwards.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MAtt*!
Jr. Member
 
Total Posts:  10
Joined:  2008-07-30
 

apasquale...your above solution worked for me.

Thank you for your help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
SPaMx182
Jr. Member
 
Total Posts:  8
Joined:  2008-12-06
 

Hey guys

I was having this problem too, but after uninstalling some extensions was fine again. My suggestion is to check up on the front end and back end after every extension you install.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cclohman
Sr. Member
 
Avatar
Total Posts:  82
Joined:  2008-06-16
Los Angeles
 

FORM_KEY was not defined on my Categories page after upgrading from 1.1.6 to 1.2.1, so I couldn’t add or click on any categories.  Grabbing the latest version of app/design/adminhtml/default/default/template/page/head.phtml and reuploading it to the server solved the issue for me.  Apparently the upgrade failed to update this file appropriately.

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

in extension to SPaMx182’s advice also make sure that you delete all your caches (at least /var/cache/*)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alf
Jr. Member
 
Total Posts:  17
Joined:  2008-01-01
 

hi,
i solved the problem this way:

i downloaded the latest zip version of magento, unzipped it, backed-up my /js folder from my “broken” magento shop on productivity-server, and uploadted the /js folder from my just unzipped magento release. that solved all problems

hope you this helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
B00MER
Sr. Member
 
Avatar
Total Posts:  130
Joined:  2007-12-27
DFW, TX
 

Had similar issues with expanding categories in the backend and custom product options.

downloaded latest zip, copied all files overwriting existing ones at (in my case <store> and <view> are both default):

/js/*.*
/app/design/adminhtml/<store>/<view>/*.*

Works now thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
idezine
Jr. Member
 
Total Posts:  2
Joined:  2009-10-13
 

I have tried editing the head.phtml,

Its still the same error.

 
Magento Community Magento Community
Magento Community
Magento Community
 
JelmoNL
Jr. Member
 
Total Posts:  2
Joined:  2011-05-24
 

Maybe bumping an old topic, but since I found out the hard way that Magento-forums are your best friend when starting out I thought I’d share my experience anyway.

I had a similar problem, when editing/creating a product I couldn\’t expand the root-categories.
Using Fiddler to find out what the hell was wrong I came accross the “{"error”:true,"error_msg":"Invalid Form Key"}" error.

It eventually turned out it was a Prototype version-problem, during development I upgraded to the newest version of Prototype.js since I had strange errors which were fixed by upgrading. Little did I know I was sinking even further under water… After downgrading again (backups people, backups) expanding worked fine again. I also applied Jemoon\’s fix suggested earlier in this thread.

Hope somebody finds this useful.

Cheers,
Jelmer

 
Magento Community Magento Community
Magento Community
Magento Community
 
kevinblack
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2011-05-10
 

Revert all js.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top