NetTalk Central

Author Topic: Opening a popup from JavaScript in NetTalk-style  (Read 2659 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Opening a popup from JavaScript in NetTalk-style
« on: August 25, 2011, 06:52:10 AM »
Hi,

I'm on my timer issue again ...

I have a piece of script on my page with a counter. On 30 seconds before it times out, I want to open a popup window that gives the user an option to continue. If the user doesn't respond, the session will timeout itself at the end of the remaining 30 seconds. All of this is done in a Javascript method.

I see that the following is used on a link that calls a popup window:

<a onclick="ntd.push('PopupPage','','',1,0,null,'','','',0,'','','','');" href="#">My Link</a>

In my Javascript method I want the same action as the onclick action. But by only using ndt.push does not work. What should the Javascript be to open PopupPage?

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Opening a popup from JavaScript in NetTalk-style
« Reply #1 on: August 25, 2011, 09:30:37 PM »
Hi Thys,

...and a horrible system just keeps getting more horrible <g>.

You're on the right track with the ntd.push. However an ntd-push doesn't actually create anything. It merely unhides something that is already there. So you'd want to add a form to your header or footer - but called very carefully in "popup ready mode". There was a thread on this recently;

If p_web.GetPreCall('PopupPage') = 0 then PopupPage(p_web,Net:Web:Popup).

Of course when the form pops up, it populates from the server, which in turn extends the session. Ditto when they press "close".

Cheers
Bruce


Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Opening a popup from JavaScript in NetTalk-style
« Reply #2 on: August 26, 2011, 12:24:25 AM »
Thanks Bruce. I will work on this next week. They have a demo on Tuesday so I have to get other things ready before then.

Just to understand better, you mention this code:

If p_web.GetPreCall('PopupPage') = 0 then PopupPage(p_web,Net:Web:Popup).

What I want to do is to call the popup from the Javascript method and not Clarion code, so I'm still not sure how to do it. I will look for the other thread on this topic to see if there is more info there.

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Opening a popup from JavaScript in NetTalk-style
« Reply #3 on: August 26, 2011, 01:28:45 AM »
>> What I want to do is to call the popup from the Javascript method and not Clarion code,

yes, but this is my point.
You don't _create_ a popup with ntd.push.
You make one that was already there, visible.

To get the form onto the page, as a popup (hidden for now) you do;

If p_web.GetPreCall('PopupPage') = 0 then PopupPage(p_web,Net:Web:Popup).

the reason your ntd.push did not work was because you hadn't done the above line.

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Opening a popup from JavaScript in NetTalk-style
« Reply #4 on: August 26, 2011, 02:01:41 AM »
Thanks. Will look at it.