bwakad Posted August 27, 2014 Share Posted August 27, 2014 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 More sharing options...
SiNNuT Posted August 27, 2014 Share Posted August 27, 2014 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. 3 Link to comment Share on other sites More sharing options...
bwakad Posted August 29, 2014 Author Share Posted August 29, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now