function finder_text_finder_element_validate in Finder 7
Same name and namespace in other branches
- 6 modules/finder_text/finder_text.module \finder_text_finder_element_validate()
Internal validation for text element.
See also
1 string reference to 'finder_text_finder_element_validate'
- finder_text_finder_element in modules/
finder_text/ finder_text.module - Implements hook_finder_element().
File
- modules/
finder_text/ finder_text.module, line 141 - The finder text module.
Code
function finder_text_finder_element_validate($element, &$form_state) {
if (isset($element['#minlength']) && $element['#minlength'] && $element['#value'] && drupal_strlen($element['#value']) < $element['#minlength']) {
form_error($element, t('%title requires a minimum of %char characters.', array(
'%title' => $element['#title'],
'%char' => $element['#minlength'],
)));
}
if (isset($element['#maxlength']) && $element['#maxlength'] && $element['#value'] && drupal_strlen($element['#value']) > $element['#maxlength']) {
form_error($element, t('%title allows a maximum of %char characters.', array(
'%title' => $element['#title'],
'%char' => $element['#maxlength'],
)));
}
}