Foros de discusión

Saving User Address/Phone/Custom Fields [Workaround]

Clark D Matthews, modificado hace 12 años.

Saving User Address/Phone/Custom Fields [Workaround]

New Member Mensajes: 2 Fecha de incorporación: 4/06/08 Mensajes recientes
Using SQL Server back end and liferay tomcat 6.x we had issues when saving users data related to any of the tabs in the identification and miscellaneous sections. Pretty much anytime you updated something without clicking through each of these categories before saving then any of the categories in this section with data would be lost on save.

I saw a bunch of tickets opened that referred to this issue but they were either closed or flagged as solved even though we still continue to have the issue on 6.0.6. As a work around (not the best solution) but a good work around we put this code into categories_navigation.jspf.

Outside of this none of the liferay core is modified in any way. That seems to be a common explanation of why this issue is occurring but we didn't modify anything in core. So... An easy trick to get things to be loaded into the model in some fashion so they don’t get blown away on save is to simulate a click on each of the categories navigation panel on load.

edit
ROOT\html\portlet\enterprise_admin\categories_navigation.jspf

We added the “navListItem” name to the anchor tag for easy searching:

<a href="#<%= sectionId %>" id="<%= sectionId %>Link" name="navListItem" >


Inside the <aui:script use="liferay-enterprise-admin"> tag, we added:



///////////////////////////////////////// MTP user save bug workaround
function fireEvent(obj, evt){
var fireOnThis = obj;
if (document.createEvent) {
var evObj = document.createEvent('MouseEvents');
evObj.initEvent(evt, true, false);
fireOnThis.dispatchEvent(evObj);
} else if (document.createEventObject) {
fireOnThis.fireEvent('on' + evt);
}
}


var navListItems = A.all('[name=navListItem]')._nodes;
for( var ni in navListItems ) {
fireEvent(navListItems[ni], 'click');
}
if( navListItems[0] ) {
fireEvent(navListItems[0], 'click');
}

///////////////////////////////////////// end MTP user save bug workaround

We included a quicky “fireEvent” functionality, but there might already be something similar included somewhere.

Hope this helps some people.