I suddenly get this error after enabling geolocation_proximity and adding geolocation: filter to the view:
Warning: implode() [function.implode]: Invalid arguments passed in form_error().

Comments

Shven’s picture

There seems to be a problem with the validation of exposed forms.
I also get this error when I change the views filter identifier (default: field_location_distance)

I guess the wrong id is passed in 'exposed_validate' (geolocation_proximity_views_handler_filter_distance.inc)

rclai’s picture

Issue summary: View changes

Hey, has there been any fix on this?

rclai’s picture

Okay so I found the issue.

It's on the file handlers/geolocation_proximity_views_handler_filter_distance.inc.

Inside the function latlng_validate().

The value checking needs to be done with isset() or !empty(), otherwise it is passing undefined values to the form_error() function.

This is what my latlng_validate() function now looks like:

function latlng_validate(&$elements, &$values) {

    if (!empty($values['googlemap'])) {
      $values['latitude'] = $values['googlemap']['lat'];
      $values['longitude'] = $values['googlemap']['lng'];
    }

    if (isset($values['latitude']) && $values['latitude'] !== "") {
      switch (TRUE) {
        case !is_numeric($values['latitude']):
          form_error($elements['latitude'], t('Invalid Latitude. Value must be numeric.'));
          break;

        case $values['latitude'] > 90:
        case $values['latitude'] < -90:
          form_error($elements['latitude'], t('Invalid Latitude. Value must be between 90 and -90.'));
          break;
      }
    }

    if (isset($values['longitude']) && $values['longitude'] !== "") {
      switch (TRUE) {
        case !is_numeric($values['longitude']):
          form_error($elements['longitude'], t('Invalid Longitude. Value must be numeric.'));
          break;

        case $values['longitude'] > 180:
        case $values['longitude'] < -180:
          form_error($elements['longitude'], t('Invalid Longitude. Value must be between 180 and -180.'));
          break;
      }
    }

    if (isset($values['search_distance']) && (!is_numeric($values['search_distance']) || $values['search_distance'] < 0)) {
      form_error($elements['search_distance'], t('Invalid Distance. Value must be a positive number.'));
    }

  }
vincenzodb’s picture

Patch file for 2.0 version