Message Boards

how to pass parameter to popup openModal window

Scarletake Bwi, modified 2 Years ago.

how to pass parameter to popup openModal window

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi 

i'd like to know how to send parameter to popup window with openModal.

<portlet:renderURL var="secondJspURL" windowState="<%=LiferayWindowState.POP_UP.toString()%>">
	<portlet:param name="mvcPath" value="/second.jsp"/>
</portlet:renderURL>


<aui:script position="inline" use="aui-base">
window.showEditSnmPrefixDialog2 = function(id) {
		alert(id);
		Liferay.Util.openModal(
			{
				title: 'My Own Title(400x400 Window Size)',
				url: '<%=secondJspURL.toString()%>',
				size: 'md',
				urlData :{
				'#<portlet:namespace />targetPart' : id, 
				}
			}
		);
}

</aui:script>

doesn't work, 

 

i also try 

url: '<%=secondJspURL.toString()%>?targetPart='+id,

doesn't work too.

 

thumbnail
Mohammed Yasin, modified 2 Years ago.

RE: how to pass parameter to popup openModal window (Answer)

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts

Hi,

You can try adding PortletNamespace to parameter name and check.

url: '<%=secondJspURL.toString()%>&<portlet:namespace />targetPart='+id,

 Also you can use Liferay.Util.addParams(parameter,url);

url: Liferay.Util.addParams('<portlet:namespace />targetPart='+id,'<%=secondJspURL.toString()%>');



 

Scarletake Bwi, modified 2 Years ago.

RE: RE: how to pass parameter to popup openModal window

Expert Posts: 326 Join Date: 12/20/10 Recent Posts

hi Mohammed

thank you very much. it works.

where can i find the document about openModal? for example, i'd like to know what is md of size mean, how to change the size to auto-fit the content..etc

again, thank you.