You are here

function geofield_proximity_search_validate in Geofield 7.2

Validate the geofield proximity search form item

1 string reference to 'geofield_proximity_search_validate'
geofield_proximity_element_process in ./geofield.elements.inc
Process function for the proximity form element

File

./geofield.elements.inc, line 323
Provides FormAPI element callbacks for geofield_latlon and geofield_proximity.

Code

function geofield_proximity_search_validate($element, &$form_state) {

  //If the origin is set, ensure the distance is set as well
  if (!empty($element['origin']['#value']) && trim($element['origin']['#value']) != '' && empty($element['distance']['#value'])) {
    form_set_error(implode('][', $element['#array_parents']) . '][distance', t('@title must be set when @origin is specified.', array(
      '@title' => $element['distance']['#title'],
      '@origin' => $element['origin']['#title'],
    )));
  }
}