This topic is locked
[SOLVED]

PDForms how to make showforminbrowser

3/27/2024 8:01:03 AM
ASPRunner.NET General questions
D
david powell author

Hi,

I have got a bit stuck using XLinesoft's PDFForms, and wonder if anyone has had the same issue, or can see where I am going wrong?

What I can do successfully:

  • installed the template
  • created a form and populatd it with an SQL query (form called "NMS_consent_form")
  • the form will fill and display correctly from the 'forms' for.
  • created another form which inputs data into the relevant tables for the SQL query

Then I followed the 'extensibility' guidance in the helpsheet, and can insert this command into the 'after save' event:

CommonFunctions.sendFormtoEmail("NMS_consent_form", new XVar("nms_scheduler.id", parameters["id"]), "email_filename.pdf", new XVar("email", "xxx@yahoo.co.uk", "subject", "PDF Subject", "body", "PDF Body"));

.... works fine, send email of pdf to target address.

But inserting this line

CommonFunctions.showFormInBrowser("NMS_consent_form", new XVar("nms_scheduler.id", parameters["id"]), "filename.pdf" );

appears to do nothing at all, not even a glimpse of a new browser opening up.

Tried the same command ins the server event of a button on list view (even though this approach not mentioned in guidance)

CommonFunctions.sendFormtoEmail("NMS_consent_form", new XVar("nms_scheduler.id", parameters["id"]), "email_filename.pdf", new XVar("email", "xxx@yahoo.co.uk", "subject", "PDF Subject", "body", "PDF Body"));

.... works fine, send email of pdf to target address.

But inserting this line

CommonFunctions.showFormInBrowser("NMS_consent_form", new XVar("nms_scheduler.id", parameters["id"]), "filename.pdf" );

..causes a server errors, with the error, on displaying showing the backgroud code of a pdf. (This a similar problem to this forum entry: https://asprunner.com/forums/topic/30232-PDFForm).

Feels as if showFromInBrowser isnt triggering a browser window.

Has anyone got any ideas?

Many thanks!

David

D
david powell author 3/27/2024

(correction: when I say 'after save ' above, what I meant was 'after record added' event).

Solution:

In the 'after record added' event of a page, to display on the webpage add MVCFunctions.Exit() after the command:

CommonFunctions.showFormInBrowser("NMS_consent_form", new XVar("nms_scheduler.id", parameters["id"]), "filename.pdf" );
MVCFunctions.Exit();

... and the filled pdf will appear in the web browser.

(unfortunately this does not work when runnig this same code from the server part of a button, still causes a server error and displays raw pdf code not the image, but works just fine in 'after record saved' at least).