Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
8
Erster Beitrag:
vor 2 Wochen, 1 Tag
Letzter Beitrag:
vor 2 Wochen
Beteiligte Autoren:
SolutionJ-Reg, Allard, Fabrice Harari

WB20 - Popup Question

Startbeitrag von SolutionJ-Reg am 01.08.2017 12:31

Hopefully a quickie for someone,

How can I close a popup page (which is a browser function) from a button whose code is server-side?

Kind Regards
Reg

Antworten:

Hi Reg,

if in your server code you do a pagedisplay or pagerefresh, as the borwser code who did open the popup is not executed again, your page should be redisplayed without it.

Otherwise, you can do a little dance:
- create an invisible edit field
- in the server code in ajax mode, write something in it
- in the browser code that did the popup opening, just before opening it, start a timer
- in the timer procedure, check if the something in question is there. When it is, close the popup

Best regards

von Fabrice Harari - am 01.08.2017 12:49
Ok, thanks, will give that a go Fabrice.

von SolutionJ-Reg - am 01.08.2017 14:53
Hi

On a button you have browserside event onclick as well. Why not use that ?

If in Ajax mode you can try the event "from AJAX process after clicking"

regards

Allard

von Allard - am 02.08.2017 13:28
Hi Allard,

I originally had it working that way, but if the data entered on the pop up was invalid in any way I couldn't find a way to keep the pop up displayed and return the user to it to correct the data because the browser code would always execute and close the pop up.

The simple solution in the end was for me to validate the data in the browser code of the button and use ReturntoCapture, that stops the server side code running. then, if all is well, the server side runs and I refresh the calling page as per Fabrice's suggestion.

Basically I just forgot to validate the data fields browser-side...

Thanks
Reg

von SolutionJ-Reg - am 02.08.2017 13:35
Hi Reg,

The code is not 100 accurate but gives you an Idea. The point is you can do a popupclose() based on a condition
if condition is not met then popup wil not be closed

You can do that, something like this:

VB
In servercode do your check. If valid then add a value to an edt_ field that is invisible:

Server code:

if ==>Check serverside if some condition is met if true then

edt_inputfield_for _test = give some value

end

Bowser code:

If edt_inputfield_for test = null then

else
popupclose(Popup_page)
end

Hope this gives some insight

regards
Allard

von Allard - am 02.08.2017 13:57
That's great, thanks...

von SolutionJ-Reg - am 02.08.2017 14:25
Hi Reg,

No problem. I always make sure that validation is done on server side. Browser side can be easily bypassed.

regards

Allard

von Allard - am 02.08.2017 15:37
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.