Hi,

I created a custom form for one of my Drupal modules and I would like to add a refresh captcha link to it. Here is my code

	$form['captcha'] = array(
		"#type" => "captcha",
		"#captcha_type" => "image_captcha/Image"
	);

Under Captcha Settings if I add my form ID to "FORM PROTECTION" settings, it seems to work. But the problem is it adds one more captcha field on top of mine and also the formatting is off too. How do I add the captcha refresh link to my custom form?

Comments

prsnjtbarman’s picture

I solve it with using the 'image_captcha_refresh.js' file copied from "image_captcha_refresh" Module to my "custom_module" folder path

drupal_add_js(drupal_get_path('module', 'custom_module') ."/templates/image_captcha_refresh.js");
ddrozdik’s picture

Hi Prasenjit,

I'm not sure that you still wait an answer, but here is the steps how to add captcha with refresh link to a custom form:
1. Create your own custom form.
2. Go to Captcha settings form and add your form id to the list, and choose type of captcha - Image

Captcha will be added to your form out of the box without any additional actions. Also It will contain a link for refreshing and image.

I hope my answer will help you.

Dmitry.

ddrozdik’s picture

Status: Active » Closed (won't fix)
muthukris’s picture

Hi prsnjtbarman,

It's worked for me. Thanks a lot. It saved my time.

Regards,
Muthu