Can't get rid of pop-ups....

Can't get rid of pop-ups....

  

I have a screen that opens up a popup and after closing the popup using popup_editor_close and returning to the original screen, the original screen is then displayed as a popup.  From my understanding once popup_editor_close has been called, all screens should no longer be a popup (unless specified as such by using a popup_editor of course).  I can't see what is causing the original screen to be switched to a popup state, does anyone have any idea what might be causing it please?

Solution

Are you by chance using a submit action on the button where you are triggering the popup_editor_close?
This causes the screen to refresh (submit the data and reload the screen), which explains why it opens up in the popup, since the popup is basicly an iframe (which behaves as a separete screen/window).

Solution

I have the Method set to Navigate on the calling button.

I meant to ask:

How are you triggering the close of the popup?
Using a button where you have a server action which runs the popup_editor_close action? Or?


*Using navigate to open the popup is exactly as it should be.

Ah sorry, yes I see what you're saying now.  You're correct, I am using a button to trigger a server action which calls the popup_editor_close.

Can I ask what exactly does Navigate mean vs Submit?  Is submit used when calling an action and navigate used to call a screen, because navigate doesn't allow me to point to a server action?

Ok, the button should be set to ajax submit instead (because all we want is for the popup to run the closing code).


The 3 methods you have (for buttons or links) are:

- Submit
- Ajax Submit
- Navigate

Navigate works just as a link, you click it and you move to the target screen.

A submit is generally used in a form, so lets say the user filled out a form and the user presses a save button.
At this point the data entered by the user is sent to the server which processes it (using the logic you have in your server action).
The problem with submit however, in order to get the data to the server it issues a refresh of the page with the input data (typically using the HTTP POST method). So basicaly causing a reload of the page.

An ajax refresh attempts to do the same as a regular submit, but instead of reloading the entire page, it's using AJAX (Asynchronous Javascript And Xml), which can run code in the background and submit data to the server, without the need of the page to be refreshed.

Ajax refresh can be useful if you wish to present the user with some feedback, or maybe load a new part of the screen (in the case of a wizard with multiple steps), on the other hand a regular submit is useful if you wish to clear the page of all data, so the user can keep entering multiple records of data into your system more quickly (ofcourse you can reach the same effect using an ajax refresh, but then you would have to do some extra work clearing all the fields).

Sienna Davids wrote:

Ah sorry, yes I see what you're saying now.  You're correct, I am using a button to trigger a server action which calls the popup_editor_close.

Can I ask what exactly does Navigate mean vs Submit?  Is submit used when calling an action and navigate used to call a screen, because navigate doesn't allow me to point to a server action?

Just an observation, to add to Joey's answer.

This behavior, open a page in the popup instead of closing it, happens if you have these two settings at the same time:

1. Button/Link in the popup is set to SUBMIT
AND
2. The action called ends in a DESTINATION node, instead of an END node.

In this situation, the popup will not be closed.
If your action does not end in a DESTINATION node, the submit (while unecessary) will also work.

But as pointed by Joey, in general, inside a popup, if you don't want to refresh the page but close it, your action should be called with an Ajax Submit.

Cheers.

Thank you, that's helpful and using Ajax Submit instead works.  However when it returns to the calling screen, that screen is not displaying the updates performed in the popup.  How best do I force a reload of the calling screen please?

Eduardo Jauch wrote:

Sienna Davids wrote:

Ah sorry, yes I see what you're saying now.  You're correct, I am using a button to trigger a server action which calls the popup_editor_close.

Can I ask what exactly does Navigate mean vs Submit?  Is submit used when calling an action and navigate used to call a screen, because navigate doesn't allow me to point to a server action?

Just an observation, to add to Joey's answer.

This behavior, open a page in the popup instead of closing it, happens if you have these two settings at the same time:

1. Button/Link in the popup is set to SUBMIT
AND
2. The action called ends in a DESTINATION node, instead of an END node.

In this situation, the popup will not be closed.
If your action does not end in a DESTINATION node, the submit (while unecessary) will also work.

But as pointed by Joey, in general, inside a popup, if you don't want to refresh the page but close it, your action should be called with an Ajax Submit.

Cheers.

Yes that was exactly the setup that I had, thanks!

But I now need to reload the calling page and not sure how best to trigger that after closing a popup?


Sienna Davids wrote:

Thank you, that's helpful and using Ajax Submit instead works.  However when it returns to the calling screen, that screen is not displaying the updates performed in the popup.  How best do I force a reload of the calling screen please?


Before sending a popup_editor_close, send a popup_editor_notify first.

Create a notify handler (if you don't have this already) on your main screen (the aforementioned calling screen)
In this notify handler you issue a refresh of the content you wish to refresh (you might need to refresh some data first though)


(PS, no need to double post, you can always edit your previous post incase you forgot something!)

Great - all working!

I added a popup notify before closing the popup, and although I didn't actually use what was passed via the notify, it triggered the OnNotify screen action in the calling screen.  In the OnNotify I added a refresh data and ajax refresh and it updates and no more popups.

Thanks so much guys, this rookie really appreciates your help!!!

No problem, nobody knows everything from the start, feel free to ask help whenever you need!

(But ofcourse you learn faster by trying some things out yourself first, this way you also explore the huge list of possibilities outsystems hold)

Thanks! (Y) 

And that's very true.  I had been fiddling around for ages changing things trying to work out what was causing the continued popups, not sure if I would have eventually worked it out in this case, hence my post - and thankfully to you guys I'll never have to find out!