04-26-2017, 12:14 PM
In the helpers.php file the following function exists:
function display_errors($errors = array()){
$html = '<ul class="bg-danger">';
foreach($errors as $error){
if(is_array($error)){
echo "<br>";
$html .= '<li class="text-danger">'.$error[0].'</li>';
$html .= '<script>$jQuery("#'.$error[0].'").parent().closest("div").addClass("has-error");</script>';
}else{
$html .= '<li class="text-danger">'.$error.'</li>';
}
}
$html .= '</ul>';
return $html;
}
When I call this function, I always get $jQuery is not defined error. Why would this occur? What am I missing?
I am calling the function using the following code:
<?php echo resultBlock($errors,$successes);
if (!$form_valid && Input::exists()){
echo display_errors($validation->errors());
}
?>
function display_errors($errors = array()){
$html = '<ul class="bg-danger">';
foreach($errors as $error){
if(is_array($error)){
echo "<br>";
$html .= '<li class="text-danger">'.$error[0].'</li>';
$html .= '<script>$jQuery("#'.$error[0].'").parent().closest("div").addClass("has-error");</script>';
}else{
$html .= '<li class="text-danger">'.$error.'</li>';
}
}
$html .= '</ul>';
return $html;
}
When I call this function, I always get $jQuery is not defined error. Why would this occur? What am I missing?
I am calling the function using the following code:
<?php echo resultBlock($errors,$successes);
if (!$form_valid && Input::exists()){
echo display_errors($validation->errors());
}
?>