Formit Spam Hook, Undefined array key

I’m using Formit with a custom TV for the email field with the spam hook.

The Formit call has this:

&spamEmailFields=`[[+custom-email]]`

I’m seeing a error in the logs saying:

...FormIt/Hook/Spam.php : 67) PHP warning: Undefined array key "[[+custom-email]]"

Is that supposed to be how things work?

I’m pretty sure [[+custom-email]] is a valid variable holder because the information from the form field is properly included in the email being sent with the email hook.

I think either you want a snippet to set the value of that placeholder (with the snippet tag above the FirmIt tag) or you want this:

&spamEmailFields=`[[*custom-email]]`

I think maybe that placeholder is getting filled in with a formit2resource snippet that runs after the spam hook. However, I tried turning on the FormItAutoResponder and that is generating a similar message, but it runs after the email hook which uses that same placeholder.

So why would FormItAutoResponder be saying:

FormIt/Hook/Autoresponder.php : 93) [FormIt] Auto-responder could not find field `[[+custom-email]]` in form submission.

after the email hook just finished sending an email successfully to [[+custom-email]]?

What is custom-email? Is it a TV or a field in your form?


When you have a form field like this
<input type="email" name="custom-email" ...>,
you use &spamEmailFields=`custom-email` (just the name, not a placeholder tag), so that the spam hook checks the content of the request parameter $_POST['custom-email'].


If a placeholder is valid in the email content (&emailTpl), that doesn’t mean that this placeholder is available before (or after) the parsing of the email content. The placeholders for the request parameters are specifically set before the email content is parsed and then deleted again.

This is what was happening for both the spam and FormItAutoResponder hooks. When I removed the brackets they both ran without errors

I guess it was a little bit confusing to know when to use the name only and when to use the full placeholder, because the documentation shows an example with &emailFrom='[[++emailsender]]' and when I used the full custom-email placeholder in &emailReplyTo=[[+custom-email]] that was filled in as expected in the email that went out.

Because it’s trying to use the tag itself rather than the value it would be replaced by.