Project:CAPTCHA
Version:6.x-2.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:soxofaan
Status:postponed

Issue Summary

I would appreciate some example code of how to include a image captcha withing a form using the forms API. I'm developing my own module and would like to employ captchas in certain circumstances. If there is an example out there that I have missed I apologize.

Comments

#1

Component:Image Captcha (image_captcha)» User interface
Category:feature request» support request

You don't need any programming to add a CAPTCHA to a form. You can add CAPTCHA's to almost every drupal generated form. Just use the "Add CAPTCHA adminstration links to forms" option in the CAPTCHA settings.

#2

Wow! Very impressive. That's a very large misunderstanding on my part. I was reading to code trying to figure what function to call.

As a follow up, is there a way for me to force the use of a captcha on a particular form when someone installs my module. The method will certainly do for me for now.

Thanks for the super quick response.

#3

As a follow up, is there a way for me to force the use of a captcha on a particular form when someone installs my module.

It's not impossible, but I would not recommend to do this.

Why would you want to do this? If someone installs your module on his site it's up to him if he want CAPTCHA protection, no? Maybe he doesn't want CAPTCHA but another spam fighting system.
It doesn't seem a good idea to create a dependency when it's not really needed.

#4

Very good point. Enforcing it would be counter the whole idea of modularity. There is few odd cases where you might want to force the use of a captcha system of some kind. For example in the case of a form that send email to arbitrary addresses. Forward a story to a friend feature for example.

#5

Status:active» fixed

There is few odd cases where you might want to force the use of a captcha system of some kind.

I wouldn't force the user, I would just suggest/recommend something. It's up to him to decide if he needs CAPTCHA, another spam filter, or maybe nothing (if he can trust all his users for example).
It's indeed all about modularity, which makes Drupal rock.

#6

Ok I'm happy. Thanks very much.

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#8

Status:closed (fixed)» active

I have the exact same need, but for different reasons, so I'm re-opening this issue. My problem is that I've themed my form using a tpl page (http://drupal.org/node/98253) and I've made it so the captcha does not render. However, the site still recognizes that the captcha is active and requires an answer before the form is submitted. I need the code that renders the captcha into the form. Is there such a "form API" for captcha? Also, is there any work on the subject of integrating captcha into the CCK? It would make rendering it on specific custom forms much easier.

#9

Status:active» fixed

CAPTCHA uses the standard form API, there is no custom form rendering involved, you can render the CAPTCHA just like you render other form elements.

Also, is there any work on the subject of integrating captcha into the CCK?

That doesn't make a lot of sense to me: CCK is for defining content bricks, while CAPTCHA is a sort of authentication thing. I don't see how you can combine these concepts.

#10

Thank you for your reply. I got around the captcha rendering issue by using a page-my_form-tpl.php modification.

CCK integration makes sense to me for a few reasons:

1. A Captcha is just another input field. If you are building a custom form through the CCK, the only way to get the Captcha to display on it is to use the admin checkbox, go to your form, find the new captcha fieldset at the bottom and enable it. This seems a little counterintuitive.

2. CCK has all sorts of fields that go through validation, such as e-mail fields, social security numbers, phone numbers, and so on. Captchas are just that-- validation.

3. You would have more control over the order in which the Captcha appears on the form. As it is now, you must put it at the bottom. (Though I don't know why you would want it anywhere else... I'm just exploring a few of the added benefits that would come from using CCK :D )

Just something to think about.

#11

Title:Example code for using captcha module with my own custom form? (document feature request)» CAPTCHA as a CCK field?
Version:5.x-3.1» 6.x-2.x-dev
Category:support request» feature request
Status:fixed» postponed (maintainer needs more info)

I'm still not convinced. But the usability issues you mention make sense.

This clearly needs some more discussion and thought.

If we would implement this, I think we should start with the Drupal 6 version.

#12

Title:CAPTCHA as a CCK field?» CCK CAPTCHA widget
Assigned to:Anonymous» soxofaan
Status:postponed (maintainer needs more info)» postponed

With the usage of hook_elements now (#423736: Big update of 6.x-2.x branch (keyword: hook_elements)), it should be fairly easy to provide a CCK CAPTCHA widget.

However, I'm planning to do this after the release of a stable 6.x-2.0 version, for example in a 6.x-2.1.

#13

webform?

#14

Subscribing, CCK widget would be great!
Greetings,
Martijn

nobody click here