Forcing Users to select location from drop-down

I have a apartment rental website using the geolocation extension, however users sometimes just type their address, and they don’t select from the dropdown, what happens is that it will not work on the geolocation and region searches, anyway to force users to select from google map addresses?

Another issue im facing is that some users would just type in the city instead of the address, any way to prevent this?

1 Like

Hi,

Thanks for reporting this, the bug is confirmed and we’ll fix it as soon as possible.

Oh thanks
any way to make a minimum of characters for the address? so users will need to include the address not just the city

Hi,

Yes, such a workaround is possible, but if you are sure that there will be no short address, we can provide a PHP snippet. Let us know if it works for you.

I would try it with 15-17 characters, addresses from google include the city and state so it will be longer then this, please send me the snippet, thanks

Hi,

Please use these PHP snippets:

  1. For search field:
add_filter(
	'hivepress/v1/forms/listing_search',
	function( $form ) {
		$form['fields']['location']['max_length'] = 10;

		return $form;
	},
	1000
);
  1. For field in add listing form:
add_filter(
	'hivepress/v1/forms/listing_update',
	function( $form ) {
		$form['fields']['location']['max_length'] = 10;

		return $form;
	},
	1000
);

Thank you its working, I just changed from ’ max_length’ to ‘min_length’, my question is how do i change the error message, thanks again

Hi,

You can try to change this in the Loco Translate plugin.