Fixing Error “[unknown object].fireEvent()”

Many people have already encountered this error in Magento when opening a client's registry or creating an order by admin. This is the error:

error: error in [unknown object].fireEvent(): 
event name: address_country_changed 
error message: zipElement.up(...).down(...) is undefined

This is how we can solve this:

  • Open file: app/design/adminhtml/default/default/template/directory/js/optional_zip_countries.phtml
  • Search for function setPostcodeOptional(zipElement, country)
  • Find the line below:
    zipElement.up(1).down('label > span.required').hide();

     

  • Replace for the code below:
    var zipElementLabel = zipElement.up(1).down('label > span.required');
    if (zipElementLabel)
        zipElementLabel.hide();

     

  •  In the same file find the line below:
    zipElement.up(1).down('label > span.required').show();

     

  •  And replace for the following code:
    var zipElementLabel = zipElement.up(1).down('label > span.required');
    if (zipElementLabel)
        zipElementLabel.show();

     

Save the file, refresh cache and you will see this error is gone.

Source: http://premius.net/blog/php/116-fixing-magento-error-error-in-unknown-object-fireevent.html