Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Dynamic values in dropdown (Cities) depending on selected State

  • Effenberg0x0
  • Effenberg0x0's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago #123435 by Effenberg0x0
Hi, I have added a "Multiple Short Text" question as the first one in my survey, to gather some user info:
- First name
- Last Name
- State
- City

Then I used the info I found here at the forum to replace the "State" text field with a dropdown control with a list of states. It's working fine.

Now, for the real question: I have used the same script to also replace the "City" text field with a dropdown. But it would be great if this second dropdown would only show cities that are in the State selected in the previous dropdown.

In other words, is there a way to make it so that the values shown in the second dropbox (cities) are dinamically loaded, depending on what is set on the first dropbox (state)?

Regards,
Effenberg
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #123436 by holch
Yes, there is a way and there is an example somewhere here in the forum for Italian states and municiples. So first you choose the state in the first dropdown, and the second dropdown will then only show the municiples in that states.

If you can't find the example let me know and I send you an example file with the version with Brazilian states and municiples. but that might take a while, so better find the example here in the forum.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Effenberg0x0
  • Effenberg0x0's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago #123440 by Effenberg0x0
I've been looking for the last hour and couldn't find it. I'd really appreciate it if you can provide me with a link, an example file, anything that could kick me in the right direction.

Thanks!
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 3 months ago #123441 by holch
Have a look at this thread where I uploaded my solution (not sure if it is still on my dropbox, probably not). But there is also the original solution with a github link:
www.limesurvey.org/en/community-services...ey-question?start=10

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose