CC-1960: Internationalize Airtime / Support translations
-overwrote zend from stringLength validator
This commit is contained in:
parent
ac0e1d07be
commit
e475c2e99e
|
@ -11,14 +11,14 @@ class Application_Form_PasswordChange extends Zend_Form
|
||||||
));
|
));
|
||||||
|
|
||||||
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
|
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
|
||||||
|
$stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 80);
|
||||||
|
|
||||||
$this->addElement('password', 'password', array(
|
$this->addElement('password', 'password', array(
|
||||||
'label' => _('Password'),
|
'label' => _('Password'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('stringTrim'),
|
'filters' => array('stringTrim'),
|
||||||
'validators' => array($notEmptyValidator,
|
'validators' => array($notEmptyValidator,
|
||||||
array('stringLength', false, array(6, 80)),
|
$stringLengthValidator),
|
||||||
),
|
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
|
|
@ -48,5 +48,24 @@ Class Application_Form_Helper_ValidationTypes {
|
||||||
|
|
||||||
return $validator;
|
return $validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function overrideStringLengthValidator($p_min, $p_max)
|
||||||
|
{
|
||||||
|
$validator = new Zend_Validate_StringLength();
|
||||||
|
$validator->setMin($p_min);
|
||||||
|
$validator->setMax($p_max);
|
||||||
|
|
||||||
|
$validator->setMessage(
|
||||||
|
_("'%value%' is less than %min% characters long"),
|
||||||
|
Zend_Validate_StringLength::TOO_SHORT
|
||||||
|
);
|
||||||
|
|
||||||
|
$validator->setMessage(
|
||||||
|
_("'%value%' is less than %max% characters long"),
|
||||||
|
Zend_Validate_StringLength::TOO_LONG
|
||||||
|
);
|
||||||
|
|
||||||
|
return $validator;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue