Foren

Trigger event on closing modal box

Harsh Kanakhara, geändert vor 6 Jahren.

Trigger event on closing modal box

Junior Member Beiträge: 74 Beitrittsdatum: 06.04.17 Neueste Beiträge
While creating blogs I am selecting categories from the modal box. When closing modal box I want to trigger event. I like to add Alloy-UI close event for that categories selector modal box but it is generated using liferay-ui taglib.


<liferay-ui:panel defaultstate="closed" extended="<%= false %>" id="blogsEntryCategorizationPanel" persiststate="<%= true %>" title="categorization">
		<aui:fieldset>
			<aui:input name="categories" type="assetCategories" />
			<aui:input name="tags" type="assetTags" />
		</aui:fieldset>
</liferay-ui:panel>


Code for binding close event on alloy-ui modal box.


modalObject.on('visibleChange', function(event) {
        if (!event.newVal) {
            alert('user closed the window');
        }
});


How can I get modal object in script for categories selector modal box to bind close event on it ?

Regards,
Harsh Kanakhara.
tran nam dinh, geändert vor 6 Jahren.

R: Trigger event on closing modal box

New Member Beiträge: 2 Beitrittsdatum: 14.03.15 Neueste Beiträge
I always used javascript to open a jsppage in AUI modal and I can bind event modal close (and more communicate between modal and opener).
You can try this tutorial http://www.liferaysavvy.com/2014/06/liferay-62-aui-dialog-liferay-popup.html?m=1

Sent from my iPhone with Liferay.com Forums
Harsh Kanakhara, geändert vor 6 Jahren.

RE: R: Trigger event on closing modal box

Junior Member Beiträge: 74 Beitrittsdatum: 06.04.17 Neueste Beiträge
Thanks for your response.

For the custom portlet I can use the same thing but the Liferay core modules how can I do that ? I am doing changes in the jsp hook for blog page. Modal Box is generated by Liferay Tag lib. So I am confused how to get modal object for that specific aui-modal ?

Currently I have set interval to check for the modal box to close and it is working fine but it is the not the proper way to it.

Please can you provide the code snippets of what you are trying to say.

Regards,
Harsh Kanakhara.
thumbnail
Ketan Savaliya, geändert vor 6 Jahren.

RE: R: Trigger event on closing modal box

Regular Member Beiträge: 117 Beitrittsdatum: 03.03.11 Neueste Beiträge
Harsh Kanakhara:
Thanks for your response.

For the custom portlet I can use the same thing but the Liferay core modules how can I do that ? I am doing changes in the jsp hook for blog page. Modal Box is generated by Liferay Tag lib. So I am confused how to get modal object for that specific aui-modal ?

Currently I have set interval to check for the modal box to close and it is working fine but it is the not the proper way to it.

Please can you provide the code snippets of what you are trying to say.

Regards,
Harsh Kanakhara.


Hi Harsh,

You can update that jsp to handle close even if it's OOTB functionality.

HTH!!

Regards,
Ketan Savaliya
Harsh Kanakhara, geändert vor 6 Jahren.

RE: R: Trigger event on closing modal box

Junior Member Beiträge: 74 Beitrittsdatum: 06.04.17 Neueste Beiträge
Thanks for your response. Yes I can handle Modal Box close event in my jsp. But my concern is Modal Box is generated using liferay:panel tag, not in my hook jsp. So how can I get the modal object for that specific modal box ?

If you can provide code snippet then it would be much helpful. emoticon

Regards,
Harsh Kanakhara.