Legacy Knowledge Base
Published Jul. 2, 2025

Embedded Language Selector with "Select Box" template throws "Uncaught TypeError: Cannot read property 'attr' of null" when switching language

Written By

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When embedding the Language Selector in the theme or a layout template and setting it to have "Select Box" template in the portlet's Configuration settings, the below error will be thrown in the browser's console upon switching the language:
    combo?browserId=othe…get-position.js:173 Uncaught TypeError: Cannot read property 'attr' of null
        at Object._defaultSubmitFormFn (combo?browserId=othe…get-position.js:173)
      at Y.CustomEvent.CEProto.fireComplex (combo?browserId=othe…mousewheel.js:539)
        at Y.CustomEvent._fire (combo?browserId=othe…t-mousewheel.js:512)
        at Object.fire (combo?browserId=othe…t-mousewheel.js:530)
        at combo?browserId=othe…get-position.js:227
        at Object._proxy (combo?browserId=othe…get-position.js:141)
        at combo?browserId=othe…ui-base-core.js:152
        at args.<computed> (combo?browserId=othe…t-mousewheel.js:373)
        at YUI._notify (combo?browserId=othe…nt-mousewheel.js:71)
        at combo?browserId=othe…nt-mousewheel.js:70
    eventually, the language won't switch as expected.

Environment

  • Liferay DXP 7.0+

Resolution

  • Make sure the portlet's instanceId has not a static value in the embedding code.

    A code like this will cause the issue:
    <@liferay_portlet["runtime"]
    instanceId="01"
    portletProviderAction=portletProviderAction.VIEW
    portletProviderClassName="com.liferay.portal.kernel.servlet.taglib.ui.LanguageEntry"
    />
    The issue will no longer occur when giving the instanceId a dynamic value, for example:
    <@liferay_portlet["runtime"]
    instanceId="FOOTER${plid}"
    portletProviderAction=portletProviderAction.VIEW
    portletProviderClassName="com.liferay.portal.kernel.servlet.taglib.ui.LanguageEntry"
    />

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base