Since the script takes all the key names from the form submitted and sends it thru email, it also takes the honeypot key name. How do you exclude this? Thanks.
Easy peasy, you just need to add in some code to make sure that the special item named honeypot is not stored in the fields variable. I would suggest using a filter before the map. Would look something like:
// here is the start of the line to edit, note you are adding in a filter before the map
var fields = Object.keys(elements).filter(function(k) {
// the filtering logic is simple, only keep fields that are not the honeypot
return (elements[k].name !== 'honeypot');
// leave the rest of the code alone
}).map(function(k) {
// altering the data here
}).filter(function(item, pos, self) {
// more filtering going on here
});
We could add some up to date instructions in the readme, anyone feel free to PR.
Yes, it worked! Thanks @mckennapsean.
this was merged.
Most helpful comment
Easy peasy, you just need to add in some code to make sure that the special item named
honeypotis not stored in thefieldsvariable. I would suggest using afilterbefore the map. Would look something like:We could add some up to date instructions in the readme, anyone feel free to PR.