Prototype.js error - 'undefined' is null or not an object

I get the following error in Prototype.js

'undefined' is null or not an object line 5557 char 5 

which is:

 var respondersForEvent = registry.get(eventName); if (Object.isUndefined(respondersForEvent)) { respondersForEvent = []; registry.set(eventName, respondersForEvent); } 

How can i fix this?

Here is the code indicating the error:

 Event.observe(window, "load", function () { Event.observe("query", "keypress", function (e) { if (e.keyCode == Event.KEY_RETURN) { search(); } }); }); 

He says the error is pressed.

+4
source share
2 answers

Do you have an item with a request identifier? Note that it cannot have a name attribute - for the code you provided, it must have a β€œrequest” as the id attribute. A valid example might be:

 <input type="text" id="query" /> 
+1
source

If you have the same problem, find a duplicate of javascript code. In my case, I have included the Magento mini search form and its associated javascript twice:

 <script type="text/javascript"> //<![CDATA[ var searchForm = new Varien.searchForm('search_mini_form_new', 'search', '<?php echo $this->__('Search entire store here...') ?>'); searchForm.initAutocomplete('<?php echo $this->helper('catalogsearch')->getSuggestUrl() ?>', 'search_autocomplete'); //]]> </script> 

Hope this helps someone with the same issue.

0
source

All Articles