|
||||
|
[Yet again I seem to be responding too my own posts .. is there anybody out there?]
One solution to the above is ... Code:
class LoginForm extends Zend_Form
{
var $form = array(
'action' => 'login',
'method' => 'post',
'elements' => array(
'username' => array('text', array(
'validators' => array(
array('alnum', false),
array('regex', false, array('/^[a-z]/i')),
array('stringLength', false, array(6, 20))
),
'required' => true,
'filters' => array('StringToLower')
...
);
function __construct()
{
parent::__construct($this->form);
$el = $this->getElement('username');
$val = $el->getValidator('alnum');
$val->setMessage("custom message for alnum", Zend_Validate_Alnum::NOT_ALNUM);
$val = $el->getValidator('stringLength');
$val->setMessage("The user name is too short", Zend_Validate_StringLength::TOO_SHORT);
$val->setMessage("The user name is too long", Zend_Validate_StringLength::TOO_LONG);
...
}
}
Is there a better way? Thanks |
|
||||
|
Actually i am using combined config files and translation files.
__________________
Zend Framework Tutorials | Zend Framework Forums | Zend Framework IRC Channel | | Zend Framework Resources | CoreShifter | Microsoft Forums | Microsoft Links | Microsoft Books |
|
|||
|
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|