留言板

JSP my account hook fire on page load

Kevin Klippenstein,修改在10 年前。

JSP my account hook fire on page load

New Member 帖子: 20 加入日期: 13-2-22 最近的帖子
Hi,

I am creating a JSP hook to enable users to add their Phone Numbers from the main "Details" page of the "My Account" section.

The issue I am having is that the Liferay script that uses the once function fires on the event:

Liferay.once( 'formNavigator:reveal <portlet:namespace /> details'

The first time that the "Details" page is navigated to this event is not fired.

Is there another event I can listen for when the Details page is initially loaded so that the script runs?

Thanks,
Kevin K.
Kevin Klippenstein,修改在10 年前。

RE: JSP my account hook fire on page load

New Member 帖子: 20 加入日期: 13-2-22 最近的帖子
I thought I would update this post just in case someone else could use this information.

Instead of listening to another event on the page I changed the jsp code from using Liferay.once(), which fires on an event, to using AUI().ready(), which if I understand correctly fires when the page html is done loading.

After modification the code became:

<aui:script use="liferay-auto-fields">
AUI().ready(
function() {
new Liferay.AutoFields(
{
contentBox: '#<portlet:namespace />phone-fields',
fieldIndexes: '<portlet:namespace />phonesIndexes'
}
).render();
}
);
</aui:script>

Initial testing of this code change satisfied our requirements.

After doing this work we ended up using custom fields linked to expando variables to handle phone numbers rather than sync phone numbers from our LDAP to the Liferay phone object model.