legacy-knowledge-base
公開されました Jul. 2, 2025

”セレクトボックス”テンプレートを備えた埋め込み言語セレクターは、言語を切り替えるときに"Uncaught TypeError: Cannot read property 'attr' of null"をスローします

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

learn-legacy-article-disclaimer-text

問題

  • テーマやレイアウトテンプレートに言語セレクタを埋め込み、ポートレットの設定で”セレクトボックス”テンプレートを持つように設定した場合、言語切り替え時にブラウザのコンソールで以下のようなエラーが発生します。
    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
    結局、言語は期待どおりに切り替わりません

環境

  • Liferay DXP 7.0以降

解決

  • ポートレットの instanceId の埋め込みコードに静的な値がないことを確認してください。

    このようなコードでは問題が発生します。
    <@liferay_portlet["runtime"]
    instanceId="01"
    portletProviderAction=portletProviderAction.VIEW
    portletProviderClassName="com.liferay.portal.kernel.servlet.taglib.ui.LanguageEntry"
    />
    この問題は、例えば instanceId に動的な値を与えても発生しなくなります。
    <@liferay_portlet["runtime"]
    instanceId="FOOTER${plid}"
    portletProviderAction=portletProviderAction.VIEW
    portletProviderClassName="com.liferay.portal.kernel.servlet.taglib.ui.LanguageEntry"
    />

追加情報

 

did-this-article-resolve-your-issue

legacy-knowledge-base