Re: [Zope] Changing REQUEST in a javascript
Firstly thankyou very much for the thorough listing of the alternatives. This should be in a FAQ somewhere.
There are a few solutions to the one select populates another problem:
One is to have the first select trigger a form post to Zope, which returns the same page with new data in the second select box cooresponding to the selection. This is the easiest to get to work cross-browser and could even work with Javascript turned off.
This is what I have now
Another method is to have Zope put all of the potential choices in the second select box into the Javascript code that gets sent to the client. You could use an associative array to do this. Then populate the second select box with the items in that key of the Javascript associative array. This method works good only when the total number of items is relatively small in both selects and doesn't change very often.
This is probably not a good idea in my case as I in the final page will have 5 SELECTS with 4-10 alternatives that are dependant on each other. The total number of permutations is too high.
A third method would be to use the Virtual Cowboys Javascript XML-RPC library to query the server "out of bound" from the client when a selection in the first box was made. The query would ask Zope for the items to put in the second select dynamically. This would work well for any number of select items, and always be up to date. It would only work on recent IE and Mozilla browsers though, because it requires DOM level 3 support.
This is an interesting idea even if I don't like limiting the types of browsers that works with it, too many of those out there.
Another method similar to 3, but not requiring anything more than Javascript 1.2(?) support and frames is to use a frameset with an invisible frame that you can refresh from the visible frame. The invisible frame would be used to send requests to Zope and receive the Javascript code necessary to populate the second list box.
This would prbably be most "Zope":ish and sounds quite neat in the sense that you could make a nice object out of the list-boxes making all very modular. Strange that there isn't a Zope Product already for this.. Not very much use for Formulator in this though (?) Have to make myself familiar with frames again, and fresh up my javascript knowledge
Which method I chose depends on a few factors:
How many items will be in each select list How comfortable are you with client-side vs. server-side programming What browsers you must support How dependant you want your application to be on Javascript
A very big thankyou again Dag
participants (1)
-
Dag Nygren