NetTalk Central

Author Topic: Extra buttons on browse  (Read 4380 times)

LyGilCo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Extra buttons on browse
« on: June 18, 2008, 11:29:55 PM »
Hi,
     I need to create an extra button on a browse called 'email'. When pressed - a routine will be called (within the browse procedure on the web server) which will email all the people in the displayed browse (The emailing routine bit I can do).
Upon completion it will then go to a NetWebPage which says something like 'Emails completed'

So I need to know -

How to create a button with text of 'email'
How to run a routine on button press
How to call another page on completion

Does anyone have an idea how to do this?

Thanks

Murray

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Extra buttons on browse
« Reply #1 on: June 19, 2008, 07:19:11 AM »
Hi Murray,

The last bit dictates the first bit.
Because you want to go to a new page (saying "emails sent") I'm gonna reword your problem a bit.

What you want to do is add a button to the browse, that takes you to a NetWebPage procedure. This procedure will send an email, then show the user a page saying "email sent".

Worded this way, the task becomes simple. Create a button on the browse row. Set the button to be an "other" button. And set the button type to be "Submit". The URL for the button is 'SendingEmail'

Then create a new procedure, a NetWebPage, called SendingEmail.
Inside this procedure code your SendEmail stuff, and then let the page say anything you like.

Cheers
Bruce

LyGilCo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Extra buttons on browse
« Reply #2 on: June 19, 2008, 05:02:46 PM »
Thanks Bruce,
                       I had thought of this approch but there are a couple of problems.

1 - The button needs to send emails to all the people on the list at once, so having the button on each browse row doesn't fit.

2 - The browse is populated from an in-mem file (being the results of a query
from the main people file). The In mem file has the /threadedcontent switch on - so that only that session (thread) sees the results. If another procedure (page) is called to send the emails then (by my understanding) a new thread is started and the contents of the In Mem file is lost (even though the sessionID may be passed to the new page)

Hopefully this makes sense

Cheers

Murray

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Extra buttons on browse
« Reply #3 on: June 20, 2008, 02:53:29 AM »
Hi Murray,

Ok, adding the button under the browse is the easy bit, and I'll dealwith that in a second.

However, your understanding of Sessions and Threads is inaccurate, and far more important. First off a session <> a thread. Indeed, a single session will result in many, many threads happening.

Specifically in this case, if you use an In-Memory file to create a browse, and the file is /THREADED, then by the time the user _sees_ the browse, the file is already gone. In short, the thread that _generates_ the browse page lasts about 1 tenth of a second and then is no more.

Certainly it's no longer there when the user clicks on a button.

So the first thing you need to do is make the memory table so the data is available across threads, and add a "SessionId" field to the table so you can filter the table based on a specific session number.

Ok, back to the button. The best way to add extra controls to the browse, is to put the browse on a Form. In other words you'd have the Form (memory, not file based, no Save or cancel buttons, style probably "None") with a Browse as one field, and then a button as another.

Cheers
Bruce

LyGilCo

  • Newbie
  • *
  • Posts: 17
    • View Profile
    • Email
Re: Extra buttons on browse
« Reply #4 on: June 20, 2008, 04:02:41 PM »
Excellent!

Thanks Bruce