Is it possible to use the CAPTCHA module on a custom HTML form created in a content page of a Drupal 7 site? I am not using the Drupal Form API or webform modules. The form has the following code:
<form id="signup_form" action="[form action]" method="post" enctype="application/x-www-form-urlencoded">
<div>
<input id="firstName" tabindex="1" type="text" name="firstName" placeholder="First Name" value="" required />
<label for="firstName">First Name* </label>
</div>
<div>
<input id="lastName" tabindex="2" type="text" name="lastName" placeholder="Last Name" value="" required />
<label for="lastName">Last Name* </label>
</div>
<div>
<input id="email" tabindex="3" type="text" name="email" placeholder="Email" />
<label for="email">Email* </label>
</div>
<input type="hidden" name="form_id" value="signup_form" />
<div>
<input id="btn-submit" tabindex="6" class="submit" type="submit" name="submitButton" value="SIGN UP" />
</div>
</form>
I'm trying to have reCAPTCHA displayed at the bottom of the page when there has been an X number of form submissions from the same IP address in a given amount of time. I was hoping CAPTCHA After could work for my custom form -- I tested it on our site's Admin Login page (/user) and it worked great, of course.
I can't seem to get any CAPTCHA displaying on my custom HTML form page. In the General Settings, I selected "Add CAPTCHA administration links to forms" and a drop-down with "CAPTCHA: CHALLENGE "RECAPTCHA" ENABLED" displayed in the content page where the form is coded.
Since the HTML id has nothing to do with $form_id... I referenced this Drupal Stack Exchange page, and haven't been able to generate the form ID...I'm wondering maybe my custom HTML form doesn't have a $form_id because it doesn't use any drupal form modules? If that's the case, then I probably can't use the CAPTCHA module. Could someone please confirm?
Perhaps I can't use any Drupal modules and may need to:
grab the user's IP address from the header via PHP:
$ip_address = $_SERVER["REMOTE_ADDR"];
store this IP address in some sort of database and add a timestamp
- delete any IP address entities in that are over an hour old
- count the number of data store entities via loop and if the same IP address appears a certain # of times in a given amount of time, then display reCAPTCHA
Any guidance would be great. Thank you!