Forums de discussion

Problems with portlet:param in liferay-portlet:renderURL tag

thumbnail
Leticia Borrajo, modifié il y a 14 années.

Problems with portlet:param in liferay-portlet:renderURL tag

New Member Publications: 19 Date d'inscription: 14/09/09 Publications récentes
Hi,

I hope somebody can give me a hint here.

I have made a form which has two popups. The first one is to choose the organization. Once the user has chosen it, the value of that organization is stored in idOrganization.

Next, I have another popup, in which the user must choose a contact person from that organization, so I have to send the idOrganization value to that popup.

The problem is that I don't know how to retrieve that value and send it. I thought the way to do it would be using javascript, so in my code I put:

<input type="button" value="Elegir" onClick="openPopupContacto()">


and the javascript function like this:

function openPopupContacto() {
	var idOrganizacion=document.<portlet:namespace />fm.idOrganizacion.value;
	var organizationWindow = window.open("<liferay-portlet:renderurl windowstate="<%= LiferayWindowState.POP_UP.toString() %>">
											<portlet:param name="struts_action" value="/ext/project/select_user" />
											<portlet:param name="idOrganization" value="+idOrganizacion+" />
											</liferay-portlet:renderurl>",
										'title',
										'directories=no, height=500, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no, width=680'); 
	organizationWindow.focus();
}


but what I receive in the popup is this:

http://localhost:8080/web/guest/home?p_p_id=EXT_PROJECT&amp;p_p_lifecycle=0&amp;p_p_state=pop_up&amp;p_p_mode=view&amp;p_p_col_id=column-1&amp;p_p_col_count=1&amp;_EXT_PROJECT_struts_action=%2Fext%2Fproject%2Fselect_user&amp;_EXT_PROJECT_idOrganization=%2BidOrganizacion%2B


If somebody can tell me how to send that param to the popup window, I would really apreciate it
thumbnail
Leticia Borrajo, modifié il y a 14 années.

RE: Problems with portlet:param in liferay-portlet:renderURL tag

New Member Publications: 19 Date d'inscription: 14/09/09 Publications récentes
Hi again,

I fixed the problem, also I don't like the solution very much, so if anybody has another one, it would be nice to know.

I changed my javascript to look like this:

function openPopupContacto() {
	var idOrganizacion=document.<portlet:namespace />fm.idOrganizacion.value;
	var cadena="<liferay-portlet:renderurl windowstate="<%= LiferayWindowState.POP_UP.toString() %>"><portlet:param name="struts_action" value="/ext/project/select_user" /><portlet:param name="idOrganization" value="valorId" /></liferay-portlet:renderurl>";
	var cadena=cadena.replace("valorId",idOrganizacion);
	alert(cadena);
	var organizationWindow = window.open(cadena,
										'title',
										'directories=no, height=500, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no, width=680'); 
	organizationWindow.focus();
}


I send the url in a string, and after that, I replace the value of valorId for the real value.
Pablo Krause, modifié il y a 14 années.

RE: Problems with portlet:param in liferay-portlet:renderURL tag

New Member Publications: 4 Date d'inscription: 23/02/10 Publications récentes
Shouldn't it be
<liferay-portlet:param />
instead of
<portlet:param />
?