Hi, I’ve just a lot of troubles with
a captcha element.
The element is put to the top and the
description to the end
I don’t know which way to turn.
Here the form
class Form_Test extends Zend_Form
{
public function init()
{
$this->setMethod('post');
$this->setAttrib('enctype', 'application/x-www-form-urlencoded');
$this->setAttrib('id','frmUserRegister');
$this->setAttrib('class','');
$translator = $this->getTranslator();
// Email
$this->addElement('text', 'email', array(
'required' => true,
'maxlength' => 255,
'title' => $translator->translate('Your email'),
'label' => 'Email :',
'filters' => array('StringTrim'),
'validators' => array(
array('EmailAddress',true),
array('Db_NoRecordExists', false, array('table' => 'tn_user',
'field' =>
'email')))
));
// Password
$this->addElement('password', 'password', array(
'required' => true,
'maxlength' => 30,
'title' => $translator->translate('Choose your password'),
'label' => 'Password :',
'filters' => array('StringTrim'),
'validators' => array(
array('stringLength',true, array(3, 30)))
));
//Re-Password
$this->addElement('password', 'repassword', array(
'required' => true,
'maxlength' => 30,
'title' => $translator->translate('Re-type your password'),
'label' => 'Re-type password :',
'filters' => array('StringTrim'),
'validators' => array(
array('stringLength',true, array(3, 30)))
));
// Firstname
$this->addElement('text', 'first_name', array(
'required' => true,
'maxlength' => 30,
'title' => $translator->translate('Your first name'),
'label' => 'First name :',
'filters' => array('StringTrim','StringtoLower','StripTags'),
'validators' => array(
array('stringLength',true, array(3, 30)))
));
// Lastname
$this->addElement('text', 'last_name', array(
'required' => true,
'maxlength' => 30,
'title' => $translator->translate('Your last name'),
'label' => 'Last name :',
'filters' => array('StringTrim','StringtoLower','StripTags'),
'validators' => array(
array('stringLength',true, array(3, 30)))
));
//Captcha
$this->addElement('captcha', 'captchaRegister', array(
'required' => true,
'label' => 'Please enter the 5 letters displayed aside:',
'title' => $translator->translate('Please enter the 5 letters
displayed above'),
'captcha' => array(
'captcha' => 'Figlet',
'wordLen' => 5,
'timeout' => 300
)
));
// Csrf
$this->addElement('hash', 'userRegisterHash', array(
'ignore' => true,
));
// Submit
$this->addElement('submit', 'userRegisterSubmit', array(
'ignore' => true,
'label' => 'Sign up',
));
$this->setElementDecorators(array(
'ViewHelper',
array(array('data' => 'HtmlTag'), array('tag' =>'td', 'class'=>
'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
$captcha = $this->getElement('captchaRegister');
$captcha->setDecorators(array(
array(array('data' => 'HtmlTag'), array('tag' =>'td', 'class'=>
'element')),
array('Label', array('tag' => 'td')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
$submit = $this->getElement('userRegisterSubmit');
$submit->setDecorators(array('ViewHelper',
array(array('data' => 'HtmlTag'), array('tag' =>'td', 'class'=>
'element')),
array(array('emptyrow' => 'HtmlTag'), array('tag' =>'td', 'class'=>
'element', 'placement' => 'PREPEND')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr'))
));
$this->setDecorators(array(
'FormElements',
array('HtmlTag', array('tag' => 'table')),
'Form'
));
}
}
--
View this message in context:
http://n4.nabble.com/Zend-form-captcha-element-decorator-problem-tp2015547p2015547.html
Sent from the Zend Framework mailing list archive at Nabble.com.