Is there any way to create TV Listbox single select which will give options based on selection of option in previous Listbox? Example: I created Listbox TV Regions which contains 8 regions. I want to create another Listbox TV called Districts which will show options only after Region is selected and shows only districts that belong to chosen region.
-
☆ A M B ☆
- 24,524 Posts
Use TVs for the input, with a snippet to generate the list boxes. MIGx would be good for this, as each TV will easily allow adding more items to the list.
Then something like this to control the display. Your snippet would be the AJAX processor.
http://stackoverflow.com/questions/6857287/how-to-make-a-cascading-drop-down-list-in-php-using-jquery
If you have a manageable number of entries, you could also use this
http://www.appelsiini.net/2010/jquery-chained-selects
there is
https://github.com/Bruno17/dddx which does exactly that
Thanks for answers. Bruno your extra looks as a thing I need however I am trying to set it up but a little explanation would help. I created TV called regions of dynamic dropdown type. but where I can put options for main list? I found that if I put name of region "first row text:" it is shown in drop down list. but when I am setting up variable for resource It is showing me all resources in drop drown. So can you please give me a brief explanation how it works?
By the way I found following message in the error log:
[2012-09-01 04:06:23] (ERROR @ /connectors/element/tv.php) [OnTVFormSave]
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/b_e_d/modx.testing-site.info/core/cache/includes/elements/modplugin/9.include.cache.php</b> on line <b>65</b>