本文整理匯總了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));
}
}
}