Webmastersite.net
Register Log In

Chained select - province, region, city
I'm stuck

Comments on Chained select - province, region, city

chris
Member

Usergroup: Customer
Joined: May 04, 2008
Location: Liège, BELGIUM

Total Topics: 13
Total Comments: 43
chris
Posted Jun 15, 2008 - 5:24 AM:

Ok, this is going to be a long one ;-)

First of all my directory will be quadri-lingual (for Belgium). I will need the field CITY in several places (user registration, link submission, event submission). I don't want to have a free input-field cause I want to avoid people filling in whatever, spelling-mistakes, etc... Also the exact city-name will be importan for other features like regional search. It's also importan to know that some of the about 650 Belgian city names exisit in up to 4 different language-versions and that they should show up depending on the user's selected language. What I thought of is to use chained select-boxes:

---------------------------------------------------------
1) select Province // 2) select Region // 3) select City
---------------------------------------------------------

Example for what I mean with chained selects: www.dynamicdrive.com/dynami...6/chainedselects/index.htm

In addition to the existing field CITY I thought of creating new fields called CITYFRENCH, CITYDUTCH and CITYGERMAN and to do the whole-chaind-selects-thing manually in 4 different languages (will be a lot of work). But I'm still confused how to submit 4 different fields to the database with only one option selected.

Example: Somebody selects the city "Brussels", but on submit I have to send:

1) Brussels ----> CITY
2) Bruxelles -----> CITYFRENCH
3) Brussel ----> CITYDUTCH
4) Brüssel -----> CITYGERMAN

Anyway - I have the feeling my solution is very much more complicated than it has to be... I also thought of having only one field "CITY" and saving all the city-names in the languages files (like this was already done with countries). But I guess the chained selects won't work like that and the cities won't be searchable (except the english ones). I spent the whole night on that, but I guess I'm on the wrong track...

Cheers,
Chris
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jun 15, 2008 - 11:45 AM:

Do you need all four values submitted at once -- meaning the submitter has to know and type the name of the city in all the languages rather than just one? Or does each link only get entered and displayed in one language (even though for any two links those could be different languages of the four)?

Are you implimenting the chained select purely in javascript like this, or are you trying to do an AJAX method with PHP (which would be very difficult)?

cities won't be searchable

You'll need to use different advanced search sections for each language, which offer the fields which apply to that language.
chris
Member

Usergroup: Customer
Joined: May 04, 2008
Location: Liège, BELGIUM

Total Topics: 13
Total Comments: 43
chris
Posted Jun 15, 2008 - 11:30 PM:

No, I wanted to use the JavaScript solution. I have no idea of AJAX anyway :-)
Each link can be entered in up to 4 languages (this does actually only concern the description and perhaps the title, not sure about that yet).

meaning the submitter has to know and type the name of the city in all the languages rather than just one?


That's exactly the point. impo the most elegant way would be to have available city names displayed in the user's selected front-end-language, but to have all the other three language versions of the selected city submitted "hidden" at the same time. Tricky, hm?
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Jun 17, 2008 - 6:45 PM:

<IF {VISITORLANGUAGE} is x>selectors in language x
<ELSE IF {VISITORLANGUAGE} is y>selectors in language y
<ELSE IF {VISITORLANGUAGE} is z>selectors in language z
</IF>

If you made the selector values all be english (even when displayed text isn't), you could use an afteraddition() plugin to assign the other language values based on a translation table you put in arrays, where the indicies are the english word.

You're still going to have to translate titles and descriptions manually though, if the submitter doesn't submit in all languages.
chris
Member

Usergroup: Customer
Joined: May 04, 2008
Location: Liège, BELGIUM

Total Topics: 13
Total Comments: 43
chris
Posted Jun 17, 2008 - 11:55 PM:

Paul wrote:
<IF {VISITORLANGUAGE} is x>selectors in language x
<?php } else if ("{VISITORLANGUAGE}" == "y") { ?>selectors in language y
<?php } else if ("{VISITORLANGUAGE}" == "z") { ?>selectors in language z
</IF>


That's what I did.

Paul wrote:

If you made the selector values all be english (even when displayed text isn't), you could use an afteraddition() plugin to assign the other language values based on a translation table you put in arrays, where the indicies are the english word.


Hmmm... I guess that's too complicated for me. I don't know anything about php except for building drupal templates around it. Means that I don't know how the function should look like and what a "translation table in arrays" is ;-)

Paul wrote:

You're still going to have to translate titles and descriptions manually though, if the submitter doesn't submit in all languages


Yes sure - actually I will make the description editable for all members so that members can do the translation. That's btw why I need edit-pages with custom-templates (see my other post). Want to create an additional edit-page where only the 4 desciption-field show up and all the other fields are hidden.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.