Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide hidden input fields in email #427

Open
rfingerlos opened this issue Feb 11, 2022 · 3 comments
Open

Hide hidden input fields in email #427

rfingerlos opened this issue Feb 11, 2022 · 3 comments

Comments

@rfingerlos
Copy link

If my previous issue, that I found the answer to and closed, wasn't seen, THANK YOU for this script, your work is greatly appreciated!!!

Now, I was wanting to "hide" some of the input fields from posting to the sheet, which following some examples in previously closed issues, I was able to do, however, those inputs that are now not showing in the sheet are still showing in the email? Would there be a way to trim them out of the email as well?

The form I'm making is for an automotive repair facility, I have separate fields for the vehicles year, make, model, engine. My idea was to have them entered individually, but then run another script on the page that will concatenate the 4 fields into a hidden input that I do want to be pulled to the sheet/email. This way there is a basic format set for the vehicle information so each time the form is submitted the vehicle information is always in the same format.

So far everything is working perfectly, except that the inputs I want to be hidden from the sheet are still showing in the email.

Thanks,

@rfingerlos
Copy link
Author

Thought I had this figured out so I closed it. Come to find out, it was;t working as intended. Still looking for feedback here.

Thanks,

@rfingerlos rfingerlos reopened this Feb 11, 2022
@mckennapsean
Copy link
Collaborator

Glad to hear the script has been helpful!

How did you hide the fields in the google sheet? Is it by hiding the columns or removing the fields in the google script?

One solution is to remove the fields in the clientside javascript, then it won’t be sent to either. I believe that’s how the honeypot fields work. I’d probably just use a new class name for your fields and filter them out.

@rfingerlos
Copy link
Author

rfingerlos commented Feb 15, 2022

I hid the fields from the sheets by hiding the columns. Issue #306 & #403 helped me overcome that.

I was looking at #176 for hiding the honeypot from emails, in hopes that it would help guide me on how to remove my fields from the emails, and this is where I came into problems. I am a total novice here, and the example given in the issue doesn't directly lead me to where and how to make the changes to the clientside script.

Here is what I have so far that semi-works...

var fields = Object.keys(elements).filter(function(k) {
      if (elements[k].name === "honeypot" || elements[k].name === "make" || elements[k].name === "model" || elements[k].name === "year" || elements[k].name === "cid") {
        honeypot = elements[k].value;
        return false;
      }

honeypot, make, model, year fields all seem to work correctly, regardless of whether there is data entered into the fields or not. When I leave the "cid" field empty on the form, the script runs properly, no data is posted to the sheet, email is sent with the 4 missing fields as it should. But as soon as I enter data into the "cid" field, the script does not run after pressing submit. The page sits idle, no thank you message displays, no data posts to sheet, no email is sent, and this is where I'm stumped. With the "cid" field being the only issue, I have renamed it both in the script and my form to make sure the name wasn't causing the issue and the results were the same. Like I mentioned previously, I'm pretty clueless as to what I'm doing, figuring I have made a huge mistake somewhere, but idk...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants