本文整理汇总了PHP中Formo::has_value方法的典型用法代码示例。如果您正苦于以下问题:PHP Formo::has_value方法的具体用法?PHP Formo::has_value怎么用?PHP Formo::has_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formo
的用法示例。
在下文中一共展示了Formo::has_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_this
protected function validate_this()
{
$this->strip_error();
$done_already = FALSE;
if ($this->value and $this->rule) {
foreach (Formo::into_array($this->rule) as $rule) {
if (!$this->_do_rule($rule)) {
$this->error = $this->error_msg;
$this->error = (is_array($rule) and isset($rule['error_msg'])) ? $rule['error_msg'] : $this->error_msg;
break;
}
}
} elseif ($this->required and strtoupper($this->required !== 'FALSE') and strtoupper($this->required) !== 'F' and !Formo::has_value($this->value)) {
$this->error = $this->required_msg;
}
}
示例2: validate
/**
* validate method. run validation through all elements in group
*
*/
function validate()
{
Event::run('formogroup.pre_validate', $this);
foreach ($this->elements as $element => $value) {
$this->{$element}->validate();
}
if ($this->required and !Formo::has_value(Input::instance()->post($this->name))) {
$this->error = $this->required_msg;
$this->add_class($this->error_class);
return $this->error;
} elseif ($this->rule) {
$rules = !is_array($this->rule) ? array($this->rule) : $this->rule;
foreach ($rules as $rule) {
$function = isset($rule['rule']) ? $rule['rule'] : $rule;
$error_msg = isset($rule['error_msg']) ? $rule['error_msg'] : $this->error_msg;
$type = $this->post_type;
if (!call_user_func($function, Input::instance()->{$type}($this->name))) {
$this->error = $error_msg;
$this->add_class($this->error_class);
return $this->error;
}
}
}
Event::run('formogroup.post_validate', $this);
}