SID-01269: Depending lists: web and topics
| Status: |
Answered |
TWiki version: |
4.3.2 |
Perl version: |
5.10.1 |
| Category: |
CategoryJavaScript |
Server OS: |
Debian |
Last update: |
14 years ago |
Hi,
I'm trying to create two lists (html select): in the first should be all webs of my twiki. After the user has chosen a web out of the list the second list should show all topics in the selected list.
The code should be part of a template. I tried to pass the first value to %TOPICLIST% via javascripts innerHtml(), but then the %TOPICLIST% is not working.
I'd be glad about any suggestion.
Thanks!
--
CarlaReitzenstein - 2011-09-08
Discussion and Answer
%TOPICLIST% is not working because it is handled on the server, and your JavaScript runs on the browser.
You could either (1) pre-load all webs and topics, or (2) load only the web list and load the topic list dynamically.
The first option can be slow if you have many topics in total. If you take this option look into
TreePlugin and
TreeBrowserPlugin.
The second option is better if you have many topics in total. You would need some Ajax magic to load all topics once a web is selected.
--
PeterThoeny - 2011-09-09
Hi Peter,
thanks for your answer! I should have noticed, that with javascript runing on the browser it's not possible to use a variable ...
So I'll have a look in an AJAX documentation to find a way to implement your second suggestion.
--
CarlaReitzenstein - 2011-09-09
For Ajax you could use the pre-installed jQuery plugin, or a handcrafted solution as described in
BlogEntry201101x2.
--
PeterThoeny - 2011-09-10
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.