You are here

function _hms_validate_form_element in HMS Field 7

HMS form element validator.

1 string reference to '_hms_validate_form_element'
hms_field_element_info in ./hms_field.module
Implements hook_element_info().

File

./hms_field.module, line 375
Provides an hms_field functionality.

Code

function _hms_validate_form_element($element, &$form_state, $form) {
  $form_input = drupal_array_get_nested_value($form_state['input'], $element['#array_parents']);
  if (_hms_formatted_to_seconds($form_input, $element['#format']) === FALSE) {
    form_error($element, t('@title field cannot be parsed. Please use format \'%format\'.', array(
      '@title' => $element['#title'],
      '%format' => $element['#format'],
    )));
  }
}