NetTalk Central

Author Topic: How to open a new a page after insert  (Read 3885 times)

seanh

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
    • Email
How to open a new a page after insert
« on: February 26, 2023, 11:00:43 PM »
I have an invoice entry form.
After completing I want to print the invoice.
So after saving and before returning to the browse I want to open a new window that will be printed.

Where and What do I do to achieve this?

Vinnie

  • Full Member
  • ***
  • Posts: 183
    • View Profile
    • Email
Re: How to open a new a page after insert
« Reply #1 on: February 27, 2023, 12:37:40 AM »
After creating an Invoice I also create a PDF file copy of the invoice which the user can download at any time.
I never print the PDF file but if the user wanted to they could not sure why.


seanh

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
    • Email
Re: How to open a new a page after insert
« Reply #2 on: February 27, 2023, 01:38:35 AM »
Thanks Vinnie,
Unfortunatly the invoice is also going to be used by kitchen staff to create the order.  So I need to print it every time.

Vinnie

  • Full Member
  • ***
  • Posts: 183
    • View Profile
    • Email
Re: How to open a new a page after insert
« Reply #3 on: February 27, 2023, 03:50:30 AM »
OK so I do this also.
I have a separate Windows exe which prints reports.
The webserver just adds a job to the list and the compiler prints.
Seamless for the user.

seanh

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
    • Email
Re: How to open a new a page after insert
« Reply #4 on: February 27, 2023, 08:04:50 PM »
I'll think about that approach, but I don't think I can guarantee Windows clients.

In the mean time I do have something that will print.
I just need to open that page before returning to the browse.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to open a new a page after insert
« Reply #5 on: February 27, 2023, 08:55:49 PM »
JavaScript does not have any print object or print methods.
You cannot access output devices from JavaScript.
The only exception is that you can call the window.print() method in the browser to print the content of the current window.

so you can put a button on the page, that calls window.print() (in javascript) then (also in javascript) triggers the print button.

It's not really a shock to discover that "silent printing from your browser" is a no-no, because well, spam.

Cheers
Bruce

seanh

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
    • Email
Re: How to open a new a page after insert
« Reply #6 on: February 27, 2023, 09:08:13 PM »
Thanks Bruce,  Yes, I know, and I have a page that does just what you suggest. 
What I don't know how to do is to call that page between saving the form and return to the browse.

Any pointers on that?

seanh

  • Jr. Member
  • **
  • Posts: 94
    • View Profile
    • Email
Re: How to open a new a page after insert
« Reply #7 on: February 28, 2023, 06:46:55 PM »
I got this working the way I want.
I added to the form an additional Save Button and changed the text to 'Save and Print'

In the browse in embed Browse Procedure -> 3 End of Procedure  I put
      IF p_web.GetValue('_buttontext_') = 'Save and Print'
          p_web.Script( p_web.WindowOpen('DocketPrint','_blank'),1)
      END

Which open a new window/tab with the print and leaves the browse in the origianal window.