我不确定如何显示外部错误消息。
场地
<?php echo Form::input('membername', $username, array('id' => 'username')); ?><?php echo Arr::get($errors, 'membername');?>
控制器
try
{
$extra_rules = Validation::factory($this->request->post())
->rule('membername', 'not_empty');
$username->update($extra_rules);
}
catch (ORM_Validation_Exception $ex)
{
$errors = $ex->errors('models/user');
}
/models/user/_external.php
return array(
'membername' => array(
'not_empty' => 'You must provide a member name.',
),
);
当该字段为空时,不会出现错误消息。