As designed Location: Please enter a value using 50 characters or fewer.

Alpha1

Well-known member
When filling in a location longer than 50 characters I get this error:

Location:
Please enter a value using 50 characters or fewer.

The location field is 50 chars. But there are various countries that have longer addresses. The UK being one of them. United Kingdom is already 13 chars. But even if you write it as UK then you easily encounter the field char limit. There are various countries that have really long addresses.

Example address which is close to 100 chars:
Burgemeester Baron van Voerst van Lyndenstraat 461, 7783 BD, Gramsbergen, Overijssel, The Netherlands

This issue also occurs in addons that reuse the location helper.
 
Last edited:
I don't think the location field is meant to hold the full city, province/state, country. I think it's meant to be an or type situation city OR province/state OR country.

People shouldn't be providing any more info than that if it's publicly viewable anyway.
 
Definitely not intended for full postal addresses, nor would we encourage that.
Yes, good point. I would not want members to use a full postal address either. It only becomes a problem when an addon that needs a full postal address uses the same function.
 
If an add-on requires a full postal address, they should really have a separate field for that and they should definitely not be publishing it on the user's profile.
 
I've run into problems with this limit using the standard google API location autocomplete.

There's tons of long addresses that autocomplete to longer than 50 characters.

upload_2017-5-6_11-56-13.webp
 
On sites that place these locations on a map, it's quite annoying as you want the map location to be accurate, and you know it will be accurate if it's a legit location recognised and autocompleted by google.
 
More information than what's needed. "waterloo station, london" brings up the same location on Google maps.

Right, I realise that, but users might not.

If you're using google autocomplete you're trying to make it easier for users to find a well formatted accurate entry for their location and to help ensure you've got a high quality database of locations.

If a user then types in 'Waterloo S', which is the minimum number of characters to get the location they're looking for, they'll then click on the autocomplete entry.

upload_2017-5-6_12-11-52.webp

That should be it, but then the forum throws them an error when they submit. Why is that? What's the point in having a properly formatted 'genuine' autocomplete location if the website I'm trying to sign up to can't even accept that value?

Then you've got to leave it to the person trying to register to edit their location and figure out what's best. That is, provided they figure out what the problem is at all.

I've definitely had users fail registration because of this seemingly arbitrary limit. I had a guy message me on facebook saying the forum was broken and he couldn't register. Turns out they didn't notice the error on the form (there's quite a few fields), and just gave up. This wasn't a very accurate address either, it was some island he lived on in East Asia and there was quite a few long words in the address.


I imagine I've probably lost more registration as a result of this, but due to the nature of lots of our community often having meetups around the world in real life, I want the locations to be accurate so they get invited to the right events in their geographic vicinity.
 
Here is an example of a city, without postal address, no zipcode but more than 50 chars as suggested by google maps:

Manchester-by-the-Sea, Massachusetts, United States

While a user can write it differently, they will just leave registration and consider the site broken.
 
While I'm thinking about it, is this hardcoded somewhere that I can just go ahead and change it? I can't seem to find anything in search.
 
Is this an add-on that's producing what's shown in the screenshots? I've never seen that directly from XF.

If it is an add-on, as Chris said, they need to produce their own database field and/or handler.
 
It is an add on. It just seems silly to need to create a second field for the exact same purpose just because you can't increase the character count for it.
 
Frankly, the fact that other add-ons change the behaviour of this field, or otherwise use it for different purposes, doesn't make this any more of a bug.

A suggestion has been made which is the most appropriate place to discuss the virtues of such a change. In the meantime, the add-on developers may wish to consider using a different field, or modifying the existing field structure themselves. It's not necessarily something we recommend but as long as it is done safely, and considers what to do if the add-on is ever removed then it shouldn't be a problem.
 
Putting aside the use of addons and focussing on core functionality from now on: as demonstrated above the 50 chars blocks users from filling in a valid address or location because many addresses or locations are longer than 50 chars.
 
It's a straw man argument. The field isn't designed for full addresses, as we've already stated. But aside from that, if I happen to live in "Manchester-by-the-Sea, Massachusetts, United States of America" and for some reason the Location field won't accept that then all I need to do is change "United States of America" to "USA" or "Massachusetts" to "MA".

It's also extremely unlikely that someone would actually type that level of detail in this field. If an add-on is exposing that, then really it's a problem for them to solve. That said, the suggestion which has been made is valid and will be considered in the future.
 
Top Bottom