留言板
aui:dialog : return to parent page
Hi All,
I've created a aui:dialog from my view.jsp page. My code looks as below.
view.jsp
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
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
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 : <%=themeDisplay.getUser().getFullName()%>
<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
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
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
Tejas Kanani,修改在12 年前。
RE: aui:dialog : return to parent page
Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
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)
communitypopup.jsp(POP UP from where I am submitting data)
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
So for my case, proper redirection worked.
Let me know if you have any question or need more details. And thanks for reminding me.
Thanks,
Tejas Kanani
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)
<%
String redirect = PortalUtil.getCurrentURL(renderRequest);
%>
<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)
<%
String redirect = ParamUtil.getString(request, "redirect");
%>
<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.
Thanks,
Tejas Kanani
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.
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,修改在9 年前。
RE: aui:dialog : return to parent page
New Member 帖子: 24 加入日期: 14-6-16 最近的帖子
actionResponse.sendRedirect(ParamUtil.getString(actionRequest,CommunityJoinConstants.REDIRECT));
Hi Tejas,
Can you elaborate it please.
Thank you.
Hi Tejas,
Can you elaborate it please.
Thank you.
Tejas Kanani,修改在9 年前。
RE: aui:dialog : return to parent page
Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
Here it will just take the redirect url that we've set in JSP
and redirect user to that url.
And if you've noticed I've keep on passing redirect url value through view.jsp -> communitypopup.jsp.
HTH.
<%
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,修改在9 年前。
RE: aui:dialog : return to parent page
New Member 帖子: 24 加入日期: 14-6-16 最近的帖子
Hi Tejas,
Understood. Thanks a lot....
Understood. Thanks a lot....