[Zope] Changing REQUEST in a javascript
Dag Nygren
dag@newtech.fi
Thu, 19 Sep 2002 21:25:52 +0300
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 retu=
rns 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 e=
ven =
> 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 c=
ould =
> use an associative array to do this. Then populate the second select bo=
x 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 se=
lects =
> and doesn't change very often.
This is probably not a good idea in my case as I in the final page will h=
ave
5 SELECTS with 4-10 alternatives that are dependant on each other. The to=
tal
number of permutations is too high.
> A third method would be to use the Virtual Cowboys Javascript XML-RPC l=
ibrary =
> 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 th=
e =
> second select dynamically. This would work well for any number of selec=
t =
> items, and always be up to date. It would only work on recent IE and Mo=
zilla =
> browsers though, because it requires DOM level 3 support.
This is an interesting idea even if I don't like limiting the types of br=
owsers
that works with it, too many of those out there.
> Another method similar to 3, but not requiring anything more than Javas=
cript =
> 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 us=
ed to =
> send requests to Zope and receive the Javascript code necessary to popu=
late =
> 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