Show Submitted Form Data on Seperate Page for Print

Jacob Reyes asked on May 7, 2018 19:00

Greetings,

Need some advice - I'm looking for away to display the form data on a separate page upon submission; which would then allow the user to print said page. For example:

  1. User fills out online form, and hits "submit".

  2. Form data posts and also displayed on a redirect page.

Is this doable with macro script on the frontend, or does this require some custom backend Visual Studio development?

Correct Answer

Peter Mogilnitski answered on May 8, 2018 05:02

Yes. If we take contact us form for example. You add to general settings -> redirect to URL: Something like ~/SpecialPages/formresult.aspx?id={%ContactUsID%} where is the url your redirect page. ContactUsID - ID field from your form (I would recommend to create unique identifier field (GUID ) and use it instead of id but for simplicity I use ContactUsID here).

Lets say my form has a couple more fields: email, phoneNumber and message, then on your result page (/SpecialPages/formresult.aspx) add static text web part and add macro:

{%  
row = SiteObjects.Forms["ContactUs"].Items.Where("ContactUsID =" + QueryString["id"]).FirstItem;
row["PhoneNumber"] + " " + row["email"] + " " + row["message"]
#%}

or

{%
row = GlobalObjects.BizForms["BizForm.ContactUs"].Items.Where("ContactUsID =" + QueryString["id"])[0];
row.GetValue("PhoneNumber") + " " + row.GetValue("email") + " " + row.GetValue("message")
#%}

P.S. Depends on your version form can be accessed a bit differently.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Jacob Reyes answered on May 10, 2018 20:48

Thanks, Peter Mogilnitski!

That worked like a charm.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.