本文整理汇总了PHP中FORM::record_error方法的典型用法代码示例。如果您正苦于以下问题:PHP FORM::record_error方法的具体用法?PHP FORM::record_error怎么用?PHP FORM::record_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FORM
的用法示例。
在下文中一共展示了FORM::record_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Check whether the current value for this field conforms.
* Doesn't return a value. Just record conformance violations with {@link FORM::record_error()}.
* @see FORM::record_error()
* @param FORM $form
*/
public function validate($form)
{
if ($this->required && $this->is_empty()) {
$form->record_error($this->id, "Please provide a value for {$this->caption}.");
}
}
示例2: validate
/**
* Make sure data is correct.
* @param FORM $form
* @param stdClass $obj
*/
public function validate($form, $obj)
{
$user_list = $form->value_for($this->base_name);
if ($user_list) {
$user_query = $this->app->user_query();
$user_names = explode(';', $user_list);
$user_ids = array();
foreach ($user_names as $name) {
$user = $user_query->object_at_name($name);
if (!$user) {
$form->record_error($this->base_name, "[{$name}] does not exist.");
} else {
$user_ids[] = $user->id;
}
}
if (sizeof($user_ids) > 0) {
$form->set_value($this->ids_name(), join(',', $user_ids));
}
}
}