How to hide the input name on form submit

122 Views Asked by At

Using formsubmit.co I've have specific names and values I'm submitting where the user would get an email with this submission on. The problem is that if the user doesn't make a check for specific feedback using the checkbox the name still appears in the email.

I was able to hide the value using hidden which is great but I need to hide the specific name 'govheading' from the email as well:

      <input type="hidden" name="govheading" value="">
      <input class="govuk-checkboxes__input" data-unchecked-value="not-agree" id="govheading" name="govheading" type="checkbox" value='Yes this relates to my feedback'>

What I have tried to do for this solution is use onsubmit="change" and write a function saying that when it gets submitted don't show the name 'govheading' but it doesn't work and pick up the name:

<form action="https://formsubmit.co/[email protected]" method="POST" onsubmit="change()">

function change() {
  document.getElementById("govheading").style.display = "none";
return true;
}

How can I hide name 'govheading' on form submit so it doesn't appear when I receive the email submission?

0

There are 0 best solutions below