I'm using 7.x-3.3+2-dev.
In views I'm using the Location: Distance/Proximity filter > single filter > 'postal code (assume default country)'
Checking "Required" does not work. I can still submit a search with this field empty.
/* Filter criterion: Location: Distance / Proximity */
$handler->display->display_options['filters']['distance']['id'] = 'distance';
$handler->display->display_options['filters']['distance']['table'] = 'location';
$handler->display->display_options['filters']['distance']['field'] = 'distance';
$handler->display->display_options['filters']['distance']['relationship'] = 'field_re_property_address_lid';
$handler->display->display_options['filters']['distance']['operator'] = 'dist';
$handler->display->display_options['filters']['distance']['value'] = array(
'latitude' => '',
'longitude' => '',
'postal_code' => '',
'country' => '',
'php_code' => '',
'nid_arg' => '',
'nid_loc_field' => 'node',
'uid_arg' => '',
'search_distance' => '30',
'search_units' => 'mile',
);
$handler->display->display_options['filters']['distance']['group'] = 1;
$handler->display->display_options['filters']['distance']['exposed'] = TRUE;
$handler->display->display_options['filters']['distance']['expose']['operator_id'] = 'distance_op';
$handler->display->display_options['filters']['distance']['expose']['operator'] = 'distance_op';
$handler->display->display_options['filters']['distance']['expose']['identifier'] = 'distoc';
$handler->display->display_options['filters']['distance']['expose']['required'] = TRUE;
$handler->display->display_options['filters']['distance']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
9 => 0,
8 => 0,
23 => 0,
16 => 0,
11 => 0,
24 => 0,
17 => 0,
18 => 0,
19 => 0,
12 => 0,
25 => 0,
20 => 0,
21 => 0,
22 => 0,
3 => 0,
13 => 0,
);
$handler->display->display_options['filters']['distance']['expose']['gmap_macro'] = array(
'default' => '[gmap ]',
);
$handler->display->display_options['filters']['distance']['expose']['user_location_choose'] = array(
'default' => FALSE,
);
$handler->display->display_options['filters']['distance']['origin'] = 'postal_default';
Comments
Comment #1
legolasboClosing support tickets that have been inactive for over a year to clean up the issue queue. Please reopen if this is still an issue.
Comment #2
millionleaves commentedI'm using this with Location 3.8 beta 2. I can confirm that it is possible to submit a search without supplying a postal code value even though the Distance / Proximity exposed filter is marked as required.
I tried adding #required to the postal code form field at around #180 in location_views_handler_filter_proximity.inc. However, this then showed the required field warning as soon as the page was loaded.
Have reopened.
Comment #3
millionleaves commentedHave opened a new ticket with more information here:
https://www.drupal.org/node/2826249