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.
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"
/>
Did this article resolve your issue ?