Jump to content

addresses... more or less


bwakad
 Share

Recommended Posts

Okay, I have a dillema...

I need to have Country > Province > City for a registration form. But to set up all those values is a bit too much.

My approach is to limit the countries and expand as time goes by. I also want to limit the tree up to province/state/county

UK : county | NL : province | US : state. But the all mean the same thing!... I named it "location".

Adding cities is as I said way too much, and I thought maybe postal codes, but that presents the same problam as just entering cities.

so I was thinking, maybe the MapMarker module is good for that.

Now I have 2 select fields in the form: country and location. Those are binded by .js to give the right locations of the country.

I understand I can add a input field to my form and have it saved as $page->marker->address = 'Miami';

At least after saving I would like to add this name in the tree (somehow) so I can use it in future with autocomplete (if possible).

And is it possible to limit this address field to the country and location selected?

Link to comment
Share on other sites

Would it be an option to call on a external webservice/API? For example http://www.geonames.org has a lot of data (8 million placenames to start with) and a whole range of ways to query their data. http://www.geonames.org/export/ws-overview.html

html

If you have the countries and 'locations' yourself, it would be easy to use their search service to find places/cities within. Or they also have ways for postal code lookups.

After that you can store the found data to PW pages if you wanted to, in exactly the way you want.

  • Like 3
Link to comment
Share on other sites

I am happy! at least for now...using the google api3 autocomplete through a plugin.

Now my form has:

- address field, which autocomplete as soon as someone starts typing.

- 3 disabled input fields, that automatically catch this input as Country, Division and City, before submitting the form.

Upon submit, I can now:

- check if these values exist as a page, and if not, create it - OR - simply use these values in a member profile field. (have to deside on this)

- Do I really need to create pages for this ??? I can search by $page->name/title OR by $field->value...

Benefit of the API

- that it can also check a users location. For instance, if I had a user providing information like being in USA, but according to API is in Europe...

- I could simply catch this value hidden, and display this value on it's profile saying "false location provided ....etc".

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...