You are here

function google_map_field_latlon_validate in Google Map Field 7

Same name and namespace in other branches
  1. 7.2 google_map_field.module \google_map_field_latlon_validate()

Custom validation function for latitude/longitude fields.

1 string reference to 'google_map_field_latlon_validate'
google_map_field_field_widget_form in ./google_map_field.module
Implements hook_field_widget_form().

File

./google_map_field.module, line 261
This file defines all the necessary hooks and functions to create a Google Map Field field type and also a WYSIWYG editor plugin for inserting maps directly into filtered content.

Code

function google_map_field_latlon_validate($element, $form, &$form_state) {
  if (!is_numeric($element['#value']) && !empty($element['#value'])) {
    $field = implode('][', $element['#array_parents']);
    form_set_error($field, t('Invalid value - @title', array(
      '@title' => $element['#title'],
    )));
  }
}