Select cities by country

  • Posts: 10
  • Thank you received: 0

1987Jan replied the topic: Select cities by country

Das ist klar :)

Wie ich oben im Script sehe, ist New York, Los Angeles abhängig von "usa". Und Berlin, Frankfurt, München ist abhängig von "germany".

Aber wenn ich nun die passenden Straßen zu den jeweiligen Ort als dritte Auswahlliste erstellen möchte, muss ich ja die Abfrage "Ort? Dann Die Str." hinterlassen.

Ich hoffe man kann das verstehen :(
#239198
  • Posts: 2986
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Select cities by country

Hello again,

I hope that we can continue in English since we don't have a German-speaking support staff member at the moment.

Could you please explain what you were trying to say because I am not sure that I've understood you properly.

Regards,

Mihaela
#239199
  • Posts: 10
  • Thank you received: 0

1987Jan replied the topic: Select cities by country

In diesem Scripte steht dass man eine Auswahliste hat (USA, Germany.) Dann soll die zweite Auswahl "0" sein und der Inhalt in der ersten Array ist dann "Texas" und co.

Nun muss eine dritte Auswahlliste vorhanden sein. Mit Straßen.
Wenn ich das wie im Scripte mache, dann muss ich ja die Städte und Dörfer in eine neue Liste machen (also wäre das ja doppelt).

Ich möchte gerne nur eine dritte Auswahlliste die "prüft" bei der Stadt/den Dorf, was da steht und dann kommt die Straße. Aber Sie kann die Stadt nicht prüfen, weil der Inhalt ja "0" sein soll.

marko.bosnjak wrote: Hello,

I've created an example for you.
Create 2 select lists. The first should be named "country" and the second "city". The first has values:

1;Select Country;none
0;USA;usa
0;Germany;germany
The second list has only "0" inserted.
Now go to the "country" element > Advanced tab > Actionscript > Type > Custom > Actions > Change and use this code in the framework:
function ff_country_action(element, action)
{
    var city = ff_getElementByName('city');

    var usaArray = new Array(
        'New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix', 'Philadelphia',
        'San Antonio', 'San Diego', 'Dallas', 'San Jose', 'Austin', 'Denver',
        'Las Vegas', 'Seattle', 'Miami', 'Washington', 'Sacramento', 'Other'
    );
    var germanyArray = new Array(
        'Berlin', 'Frankfurt', 'München', 'Köln', 'Frankfurt am Main', 'Stuttgart',
        'Düsseldorf', 'Dortmund', 'Essen', 'Leipzig', 'Bremen', 'Other'
    );
    if (element.value == 'none') {
        // drop cities
        while (city.options.length > 0)
            city.options[city.options.length-1] = null;
    } else {
        // get the matching array
        var selectedArray = eval(element.value+'Array');

        // drop supernumerous option
        while (selectedArray.length < city.options.length-1)
            city.options[city.options.length-1] = null;

        // add the new options
        city.options[0] = new Option('Select City', 'none', true, true);
        for (var i=0; i < selectedArray.length; i++)
            city.options[i+1] =
                new Option(selectedArray[i], selectedArray[i]);
    }
}
Simply add more cities in the arrays between single quotes.
I will attach you the form. Install it and test it out.

Regards,
Marko

#239202
Moderators: ForumSupporttomeperica
Time to create page: 0.040 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here