top of page

How can my customers print a copy of the contact form they submitted through a Wix website?


Who is our customer and what problem did they want to solve?


Many of our clients have requested a way for their users to store a copy (for their own records) of their submissions via their contact form.



What solution did we provide?


Using the onWixFormSubmitted method for Wix Forms, we were able to capture the fields that were submitted and then display them back on the page (where the "Thank you for submitting" message would normally be) for the customer to view and print.




Check out the code we used below:


$w.onReady(function () {
  $w("#multiStepForm1").onWixFormSubmitted(({ fields }) => {
    // console.log(fields);
    let submissionMessage = `Thank you for submitting! Submitted data is displayed below.<br/> Please print for your records<br/><br/>`;
    const fieldTemplates = buildSubmissionMessage(fields);
    $w("#text24").html = submissionMessage + fieldTemplates;
  });
});

function buildSubmissionMessage(fields) {
  const FIELD_TEMPLATE = `{{fieldName}}: {{fieldValue}}<br/>`;
  const fieldTemplates = fields.reduce((acc, { id, fieldValue, fieldName }) => {
    // console.log(`${fieldName}: value type ${typeof fieldValue}`);

    if (fieldName === "Multi-line Address") {
      const fieldTemplate = `ADDRESS: ${fieldValue.streetAddress}<br/>
			CITY: ${fieldValue.city}<br/>
			STATE: ${fieldValue.region}<br/>
			ZIPCODE: ${fieldValue.zipCode}<br/>`;
      // console.log(fieldTemplate);
      acc.push(fieldTemplate);
    }

    if (id.includes("datePicker")) {
      const fieldTemplate = `${fieldName}: ${fieldValue.toLocaleDateString()}<br/>`;
      // console.log(fieldTemplate);
      acc.push(fieldTemplate);
    }

    if (id.includes("timePicker")) {
      const fieldTemplate = `${fieldName}: ${tConvert(fieldValue)}<br/>`;
      acc.push(fieldTemplate);
      return acc;
    }

    if (id.includes("checkboxGroup") && typeof fieldValue[0] !== "undefined") {
      const fieldTemplate = `${fieldName}: ${fieldValue[0]}<br/>`;
      // console.log(fieldTemplate);
      acc.push(fieldTemplate);
    }

    if (typeof fieldValue === "string") {
      const fieldTemplate = FIELD_TEMPLATE.replace(
        "{{fieldName}}",
        fieldName
      ).replace("{{fieldValue}}", fieldValue);
      // console.log(fieldTemplate);
      acc.push(fieldTemplate);
    }

    return acc;
  }, []);

  return fieldTemplates.join("");
}

function tConvert(time) {
  // Check correct time format and split into components
  time = time.replace(".000", "");
  time = time.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/) || [
    time,
  ];

  if (time.length > 1) {
    // If time format correct
    time = time.slice(1); // Remove full string match value
    time[3] = +time[0] < 12 ? " AM" : " PM"; // Set AM/PM
    time[0] = +time[0] % 12 || 12; // Adjust hours
  }

  return time.join(""); // return adjusted time or original string
}



Have questions about this? Contact us at 225-250-1888 or email robert@roberthebertmedia.com.



About our company


RHM specializes in helping businesses of all sizes and across all industries achieve their digital and web marketing needs. Whether it's designing a new website, building an app, performing custom development, or running Google Ads, our goal is to showcase how you are the best at what you do and help people connect with you. Contact us at 225-250-1888 to get started!








 
 
 

6 Comments


Cole Kelp
Cole Kelp
13 hours ago

This is a great solution for businesses wanting to provide customers with a copy of their contact form submissions. It's helpful to know that there's a way to view and print the details easily. For more insights, check out trees hate you.

Like

Very practical and helpful guide for Wix users who want to improve user experience on their websites. The steps are explained clearly, making it easy for non-technical users to follow. I recently came across a similar discussion on a review blog, and it offered an interesting perspective as well. It also connects with how https://gocollectiv.com/ style resources often focus on improving usability and simplifying website interactions for end users.

Like

henty1308 lee
henty1308 lee
Nov 04, 2025

Some love calculator use additional factors such as zodiac signs. This helps to bring a more personalized feeling to the user.

Like

moha selena
moha selena
Nov 01, 2025

Clicker Games online provide a unique mix of strategy and relaxation, letting players advance with each click while unlocking new features and achievements.

Like

Sam Dillard
Sam Dillard
Oct 10, 2025

Collecting presents is rewarding, but not worth crashing for Snow Rider! Grab gifts when it’s safe, and remember that surviving longer gives you more chances to earn them anyway.


Like
bottom of page