function form_basic_validate
Search API
7.x render.inc | form_basic_validate($form, $form_state) |
6.x render.inc | form_basic_validate($form, |
4.x forms.inc | form_basic_validate($form, $form_submitted) |
5.x render.inc | form_basic_validate($form, $form_submitted) |
This is a very basic valiator for form API submission. All I really care about is making sure required fields have a value in them. If they do not, we will file a form_error.
1 call to form_basic_validate()
- system_handle_form_submit in modules/
system/ system.module - Intercepts form submissions from System Settings Forms.
File
- includes/
forms.inc, line 248
Code
function form_basic_validate($form, $form_submitted) {
foreach ($form as $name => $element) {
if (is_array($element) && $element ["required"]) {
// Okay, this is a required field. So, check that it has a non-blank value
// in form_submitted.
if ($form_submitted ["values"][$name] == "") {
// It's blank! ERROR!
$label = $element ["label"];
if ($label == "") {
$label = $name;
}
form_error($name, t("You must enter a value for <b>%element_label</b>", array("%element_label" => $label)));
}
}
}
}