我在字段 postalCode 上的 validate/confirm.yml 中进行了验证检查:
postalCode:
required: yes
required_msg: ENTER_VALID_POSTALCODE
validators: numberValidator
numberValidator:
class: sfNumberValidator
nan_error: NOT_A_NUMBER_ERROR
出于某种原因,我想在我的操作文件中移动类 sfNumberValidator 的逻辑或相同功能。
喜欢
class registerActions extends sfActions
{
public function validateConfirm() {
....
...
$postalCode = $this - > getRequestParameter('postalCode');
if (postalCode != '') {
//Do the same kind of validation like sfNumberValidator does
}
}
....
}