NetTalk Central

Author Topic: Need to force user to click 'PDF' button before clicking Send to send email  (Read 5914 times)

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Hi All: This will be easy, but I'm having trouble figuring out where to handle it. 

I have an email Form that contains a Button to generate a pdf report that will be attached to the email.  The Button to create the pdf file needs to be pushed prior to "Send."  It works fine as long as the user remembers to first create the attachment.  I've tried a couple of things, but haven't gotten it right.  I am using a Progress control and have a "Preview" link that appears when the report is done.

Many thanks,

Jim


terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Hi Jim
Is there a reason why they must press the PDF button, e.g. If they don't then they won't get a PDF.
Is there a reason why you don't include the PDF creation into your send procedure?
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Hi Terry:  It's mainly because I'm struggling with embed points, etc.

Here's what I need to do:

1. Open the memory form with the fields needed to produce the email.
2. Print the pdf
3. Capture the pdf name
4. Rename the pdf
5. Call SendMail with the parameters
6. Wait for a response and close Form

It's easy to use the PDF Button -- it also creates the link for previewing the file.  I'm not sure where to embed Printing the PDF and displaying the link so it doesn't get cleared when the user enters information.

Probably doesn't make a lot of sense.  That's why I asked.

Thanks,

Jim

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Hi Jim I was just trying to establish if sometimes a pdf was not printed and sent.
Are you using Clarion report to PDF or PDF-Tools?
Let me know and I will send you my code, embeds etc.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Hi Terry:  Yes, there are times when it is not sent (only when the user changes his mind, I suppose).  I'm using PDF-Tools. 

Thanks much for your help!

Jim

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Hi Jim,

Does the user need to preview the pdf report?

If not, you could just generate it on the Send button click.

OR better still, call a webservice from the send button click which then goes away and does the stuff (generate pdf, send email), and allows the user to carry on.

OR a little more excitement, you could call the webservice but instead of generating the pdf just include a special custom link in the email (tailored for the person the email is sent to) that allows them to click and download the pdf report from their device.

Lots of good stuff comes out of that (tracking, understanding, streamlining process).

But if they need to see the report on the netwebform, then those things won't solve that problem.

It's a bit of a hack, but you could:
1. On the memory form remove the cancel button and change the save to a "Close".
2. Add a "Send" button to the form, hide it based on a session value (say sendreport:Okay).
3. On opening form, set to zero, p_web.SSV('sendreport:Okay',0).
4. When the report is generated, set to 1, p_web.SSV('sendreport:Okay',1).
5. Make sure you are refreshing the custom "Send" button after report is generated.
6. Send button should then be readonly/hidden (whichever you choose in the template) until the pdf is generated.

Hope that helps.
Cheers,

Stu Andrews

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Hi Stu:  Thanks for all of the great ideas.   Your post is very helpful and gives me incentive to push ahead. 

Best,

Jim

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
My apologies for all of the questions lately.  I had all this working in C6 a few years back but just can't seem to get it right in C10. 

One of my problems is finding the right embed points for what I'm trying to do. I tried numerous things.  Then I saw where you can tick the box that says 'Start Automatically when Form generates.'  That works great. (Finding a lot of places where Bruce has made things easier.)  But when I do a lookup to get the email address, it automatically generates again.

I'd like it to generate the .pdf after the lookup procedure has been called and the Loc:EmailAddress has been filled.  Which embed point do I need?

Many thanks.

Jim 

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Finally getting to the bottom of this. 

I should have been paying closer attention to the logs.  When my memory form opens, it receives the unique ID field from the record that the user clicked on in the Browse.  The ID gets passed in the URL and shows up in the Referer: of the Post Log.  Then, when the user clicks to look up the email recipient, the Referer: changes, and the original ID is cleared. I was setting the p_web.SSV(Record:ID) when the Form was started.  That worked fine as long as the Refer was the original Browse.  The p_web.SSV() overwrote the Record:ID with a zero when it came back from the lookup.  By enclosing the p_web.SSV() in a conditional statement, I can preserve the original ID.

An aha! moment -- for me at least.  Now I can try some of the suggestions that were made.

Thanks again for the help.