function rules_forms_action_set_error in Rules Forms Support 7
Same name and namespace in other branches
- 7.2 includes/rules_forms.eval.inc \rules_forms_action_set_error()
Action: Set form error.
Parameters
mixed $form: A reference to the form array of the form for which the event was triggered.
string $element: The element ID of the element being checked in the form of element_type:element_id.
string $message: The error message to set on the form element.
1 string reference to 'rules_forms_action_set_error'
- rules_forms_rules_action_info in ./
rules_forms.rules.inc - Implements hook_rules_action_info().
File
- includes/
rules_forms.eval.inc, line 436 - Evaluation functions for Rules Forms module.
Code
function rules_forms_action_set_error($form, $element, $message) {
if (strpos($element, ':') !== FALSE) {
$form_element =& _rules_forms_get_element($form, $element);
// Remove the element type information.
$element = substr($element, strpos($element, ':') + 1);
if (isset($form_element['#parents'])) {
$element = implode('][', $form_element['#parents']);
}
else {
$element = str_replace(':', '][', $element);
}
}
form_set_error($element, $message);
}