weight for image

erdemkose - July 24, 2006 - 09:18
Project:Textimage
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:wundo
Status:closed
Description

I was trying to use textimage/captcha and logintoboggan module together. But when I enabled "use 2 e-mail address" in logintoboggan module, textimage/captcha challenge places itself between two e-mail address field.

This is my registration form:

Username: *
Your full name or your preferred username; only letters, numbers and spaces are allowed.

E-mail address: *
A password and instructions will be sent to this e-mail address, so make sure it is accurate.

Captcha Validation: *
Please type in the letters/numbers that are shown in the image above.

Confirm e-mail address: *
Please re-type your e-mail address to confirm it is accurate.

Password: *
Please choose a password for your account; it must be between 6 and 30 characters and spaces are not allowed.

Confirm Password: *
Please re-type your password to confirm it is accurate.

I want captcha to be placed as the last element. So I added a '#weight' => 30, to function textimage_captchachallenge(&$form). I also added <div></div> around <img .. /> tag.

<?php
function textimage_captchachallenge(&$form) {       
 
$form['captcha_response'] = array (
   
'#type' => 'textfield',
   
'#title' => t('Captcha Validation'),
   
'#default_value' => '',
   
'#required' => TRUE,
   
'#validate' => array('_captcha_validate' => array()),
   
'#description' => t('Please type in the letters/numbers that are shown in the image above.'),
   
'#prefix' => '<div class="captcha-textimage"><img src="' . url('_textimage/image/'.time()) . '" '.$imageSize[3].'  alt="Captcha Image: you will need to recognize the text in it."/></div>',
   
'#weight' => 30,
  );

  return
$form;
}
?>

If you agree that captcha/textimage should be the last element, please commit a patch.

#1

ardas - August 24, 2006 - 11:24

You can use form_alter hook to change weight for your specific site. There is no need to do it in the module because someone may prefer to show captcha not in the very end.

#2

wundo - August 24, 2006 - 13:01
Assigned to:Anonymous» wundo

I think that is not a good option force the user to do an form alter for this, not everyone is an programmer.

#3

Deciphered - February 6, 2009 - 04:56
Status:active» closed

Captcha no longer supported in Textimage.

 
 

Drupal is a registered trademark of Dries Buytaert.