Foros de discusión

aui:dialog : return to parent page

thumbnail
Tejas Kanani, modificado hace 12 años.

aui:dialog : return to parent page

Liferay Master Mensajes: 654 Fecha de incorporación: 6/01/09 Mensajes recientes
Hi All,

I've created a aui:dialog from my view.jsp page. My code looks as below.

view.jsp
<aui:button name="joinButton" type="button" value="${buttonTitle}" last="true" onClick="joinCommunityPopup()" />

<portlet:renderurl var="itemDetailURL" windowstate="POP_UP">
	<portlet:param name="jspPage" value="/html/portlet/community-join/communitypopup.jsp" />
</portlet:renderurl> 

<script type="text/javascript">
	function joinCommunityPopup() 
	{
		AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
			var dialog = new A.Dialog({
			        title: '${popupTitle}',
			        centered: true,
			        draggable: true,
			        modal: true,
			        width: 400, 
			        height: 200,
			    }).plug(A.Plugin.IO, {uri: '<%=itemDetailURL%>'}).render();
			
			dialog.show();
		});
	}
</script>


Now inside that dialog I've kept one submit button and its working fine as well. It's going to processAction in my controller as it should.

communitypopup.jsp
<portlet:actionurl var="joinCommunityURL" name="joinCommunity">
	<portlet:param name="redirect" value="<%= redirect %>" />
</portlet:actionurl>

<aui:form action="<%= joinCommunityURL %>" method="post" name="fm">
	<aui:input name="<%= Constants.CMD %>" type="hidden" value="JOIN" />
	<aui:input type="hidden" name="redirect" value="<%= redirect %>" />
	
	Your Name : &lt;%=themeDisplay.getUser().getFullName()%&gt;
	<aui:input type="textarea" name="reasonForAccess" />
	<aui:button-row>
		<aui:button type="submit" value="Request Access" />
	</aui:button-row>
</aui:form>


Now how should I come back to my view.jsp page after completing the submit logic. So basically the dialog should be closed and I should be back on my view mode.

Any idea how can I do that ??? Any pointer would be much appreciated.

Thanks,
Tejas
thumbnail
Mayur Patel, modificado hace 12 años.

RE: aui:dialog : return to parent page

Expert Mensajes: 358 Fecha de incorporación: 17/11/10 Mensajes recientes
Hi Tejas,

If you can use Resource Phase instead of action Phase, On call back you can close dialog box using javascript and Refresh that Page.

Please Share your ideas if you've already implemented because this scenario is very much encountered in most of the cases

Thanks,
Mayur
thumbnail
Tejas Kanani, modificado hace 12 años.

RE: aui:dialog : return to parent page

Liferay Master Mensajes: 654 Fecha de incorporación: 6/01/09 Mensajes recientes
Hi Mayur,

I was able to resolve that issue. Just forgot to reply about resolution in hurry. Below are my code.

View.jsp (Where my POP UP calling code resides)
&lt;% 
	String redirect = PortalUtil.getCurrentURL(renderRequest);
%&gt;

<portlet:renderurl var="itemDetailURL" windowstate="POP_UP">
	<portlet:param name="jspPage" value="/html/portlet/community-join/communitypopup.jsp" />
	<portlet:param name="redirect" value="<%= redirect %>" />
</portlet:renderurl>

<aui:button name="joinButton" type="button" value="${buttonTitle}" last="true" onClick="joinCommunityPopup()" />
<script type="text/javascript">
	function joinCommunityPopup() 
	{
		AUI().use('aui-dialog', 'aui-io', 'event', 'event-custom', function(A) {
			var dialog = new A.Dialog({
			        title: '${popupTitle}',
			        centered: true,
			        draggable: true,
			        modal: true,
			        width: 635, 
			        height: 340,
			    }).plug(A.Plugin.IO, {uri: '<%=itemDetailURL%>'}).render();
			
			dialog.show();
		});
	}
</script>


communitypopup.jsp(POP UP from where I am submitting data)

&lt;%
	String redirect = ParamUtil.getString(request, "redirect");
%&gt;

<portlet:actionurl var="joinCommunityURL" name="joinCommunity">
</portlet:actionurl>

<aui:form action="<%= joinCommunityURL %>" method="post" name="joinCommunityfm">
<aui:input type="hidden" name="redirect" value="<%= redirect %>" />
       .... your input fields come up here.
</aui:form>


processAction of my controller
- Just redirect it to proper url from you processAction method as a last call, which we've maintained from view.jsp

actionResponse.sendRedirect(ParamUtil.getString(actionRequest,
				CommunityJoinConstants.REDIRECT));


So for my case, proper redirection worked.

Let me know if you have any question or need more details. And thanks for reminding me.emoticon

Thanks,
Tejas Kanani
Vipul Patel, modificado hace 9 años.

RE: aui:dialog : return to parent page

New Member Mensajes: 3 Fecha de incorporación: 5/02/11 Mensajes recientes
Hello Tejash,

I am using liferay aui dialog box. I am submitting form inside dialog box with ajax call. But it is not getting submit. Ajax call is getting failed.

Can you please suggest some solution ?

Thanks in advance.
Swetha Harshini, modificado hace 9 años.

RE: aui:dialog : return to parent page

New Member Mensajes: 24 Fecha de incorporación: 16/06/14 Mensajes recientes
actionResponse.sendRedirect(ParamUtil.getString(actionRequest,CommunityJoinConstants.REDIRECT));

Hi Tejas,

Can you elaborate it please.

Thank you.
thumbnail
Tejas Kanani, modificado hace 9 años.

RE: aui:dialog : return to parent page

Liferay Master Mensajes: 654 Fecha de incorporación: 6/01/09 Mensajes recientes
Here it will just take the redirect url that we've set in JSP
<%
String redirect = ParamUtil.getString(request, "redirect");
%>

and redirect user to that url.
actionResponse.sendRedirect(ParamUtil.getString(actionRequest,"redirect");


And if you've noticed I've keep on passing redirect url value through view.jsp -> communitypopup.jsp.

HTH.
Swetha Harshini, modificado hace 9 años.

RE: aui:dialog : return to parent page

New Member Mensajes: 24 Fecha de incorporación: 16/06/14 Mensajes recientes
Hi Tejas,
Understood. Thanks a lot....