3

I have a custom module that renders a form. In hook_form_alter() I have added honeypot_add_form_protection($form, $form_state, array('honeypot'));

Though, when I perform 'Inspect Element usnig chrome I cannot see any honeypot fields in the html of the page. So, I'm slightly confused on whether this actually work or not.

Any idera on how to test this or atleast see that the form is protected by the Honeypot module?

  • Did you search the source for 'honeypot'? There should be hidden fields. – Chris Rockwell Feb 4 '15 at 19:04
4

You can enable an option Log blocked form submissions on page admin/config/content/honeypot, set Honeypot time limit to, let's say, 30 seconds and try to submit your form faster than 30 seconds. Then check your log (admin/reports/dblog). You will see Honeypot log message if it worked.

And you probably should include some option in array:

  honeypot_add_form_protection($form, $form_state, array('honeypot', 'time_restriction'));

Note that you can enable or disable either the honeypot field, or the time restriction on the form by including or not including the option in the array. (https://www.drupal.org/node/1232638)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.