1

Creating nodes can take a long time. That is why for one specific part of my site, I have created my own custom form. The problem is, I want to use the captcha plugin so I don't have to get another separate module for that.

How can I use the Captcha module PROGRAMATICALLY so that I don't need a separate libary?

4

From looking at the code in the Captcha module, it looks like Captcha defines a new form element.

So an example would look like:

$form['name'] = array(
  '#type' => 'textfield',
  '#title' => t('Name'),
);
$form['captcha'] = array(
  '#type' => 'captcha',
  '#captcha_type' => 'captcha/Math',
);

Where captcha/Math is the module that provides a type of captcha, followed by the type of captcha to use.

  • and how can I set the refresh button? – Mazba Kamal Jun 12 '17 at 9:24

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.