- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2020 12:01 AM
Hi Listers,
We are currently displaying a record producer in a modal window using ui page
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_url"
expression="RP.getWindowProperties().get('url_param')">
</g:evaluate>
<iframe id="rp_frame" src="${jvar_url}" width="800" height="600" />
</j:jelly>
The problem is that when the producer Submit button is clicked, the new created record is displayed inside the dialog window. Is there a simple way to just close the modal window after the producer is submitted?.
Thanks for your help.
Victor
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 05:56 AM
After some investigation I finally found a solution which is not altogether perfect - but serves my purpose. The idea is to use .load() event of the iframe
var iframe = $j('#rp_frame');
iframe.load(function(){
var catItem = iframe.contents().find('#cat_item_view');
var catItemId = catItem.attr('id');
if(!catItemId){
GlideDialogWindow.get().destroy();
}
}
Regards,
Victor.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 05:55 AM
Sorry victor, I don't know what you have or have not tried or thought of so I just wanted to suggest what works for me and most everyone else when using UI Page.
You'd need to handle the validation then.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 05:56 AM
After some investigation I finally found a solution which is not altogether perfect - but serves my purpose. The idea is to use .load() event of the iframe
var iframe = $j('#rp_frame');
iframe.load(function(){
var catItem = iframe.contents().find('#cat_item_view');
var catItemId = catItem.attr('id');
if(!catItemId){
GlideDialogWindow.get().destroy();
}
}
Regards,
Victor.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 06:04 AM
Yep and using
GlideDialogWindow.get().destroy();
Glad you got it resolved. Using iframes is already a wonky process as is...so when you validate appropriately...you can close it properly.
Take care!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2023 07:06 AM - edited ‎10-18-2023 07:13 AM
This helped me so much after being stuck for ages on a similar requirement!
For anyone else reading this, here is my HTML from my UI Page. My requirement is to load/embed a custom service portal widget within my UI Page/iframe (this is done in the ui page client script) and then wait for a $scope.$emit event from the client script of the widget to do something. The event was simply emitted after a button click on the widget. I was having no luck figuring out how to listen for an event from my UI Page and iframe.load was the only thing that worked.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<iframe id="portal_page_frame" style="height: 700px; width: 100%; border: none;"></iframe>
<script>
(function() {
var iframe = $j('#portal_page_frame');
iframe.load(function(){
//listen for the success event from the embedded widget
var iframeScope = iframe[0].contentWindow.angular.element(iframe[0].contentDocument).scope();
iframeScope.$on('signatureSubmittedSuccess', function () {
setTimeout(function() {
GlideDialogWindow.get().destroy();
}, 1750);
});
});
})();
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 06:00 AM
Hello,
I think the below case is similar to yours . Please , have a look at it and implement in yours scenario
Mark my ANSWER as CORRECT and HELPFUL if it helps...