Re: [Zope] Changing REQUEST in a javascript
[om: Dag Nygren]
I now finally figured out the parameter-passing stuff and ran into a new problem: I need to change the REQUEST on the client, presumably in a javascript
Can this be done and How ?
There is no such thing. The browser client has form data that it submits, and the Zope REQUEST object ends up containing the form data. The client knows nothing about Zope objects.
Tell us what you really want to accomplish and we will help you work out how to do it.
Yes, of course, sorry for the a bit naive question. I am new to Zope and Phyton and had difficulties getting the right picture in my mind about what is going on here. Additionally the Zope way of "inheriting" the REQUEST object confused me. The original problem was creating a mutiselect form where select#1 changed the alternatives of Select#2. I also did not want the URL to show the parameters. I now figured out that I can use an ONCHANGE=document.submit() for Select#1 to make the same formpage repeat itself with the changed Select#2 attributes. Additionally I think (haven't tested yet) that I can submit and alternative attribute in the "real" formsubmit and check for that with <dtml-if> in the form and then do the intended insert into a database. Please tell me if there is something fundamentally wrong with this way of thinking and if there are easier ways of doing this. Thanks for the answers so far, preserves my fate in the OpenSource community !! -- Dag Nygren email: dag@newtech.fi Oy Espoon NewTech Ab phone: +358 9 8024910 Träsktorpet 3 fax: +358 9 8024916 02360 ESBO Mobile: +358 400 426312 FINLAND
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. 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. 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. 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. 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 hth, Casey On Wednesday 18 September 2002 12:53 pm, Dag Nygren wrote:
[om: Dag Nygren]
I now finally figured out the parameter-passing stuff and ran into a new problem: I need to change the REQUEST on the client, presumably in a javascript
Can this be done and How ?
There is no such thing. The browser client has form data that it submits, and the Zope REQUEST object ends up containing the form data. The client knows nothing about Zope objects.
Tell us what you really want to accomplish and we will help you work out how to do it.
Yes, of course, sorry for the a bit naive question. I am new to Zope and Phyton and had difficulties getting the right picture in my mind about what is going on here. Additionally the Zope way of "inheriting" the REQUEST object confused me.
The original problem was creating a mutiselect form where select#1 changed the alternatives of Select#2. I also did not want the URL to show the parameters.
I now figured out that I can use an ONCHANGE=document.submit() for Select#1 to make the same formpage repeat itself with the changed Select#2 attributes. Additionally I think (haven't tested yet) that I can submit and alternative attribute in the "real" formsubmit and check for that with <dtml-if> in the form and then do the intended insert into a database.
Please tell me if there is something fundamentally wrong with this way of thinking and if there are easier ways of doing this.
Thanks for the answers so far, preserves my fate in the OpenSource community !!
-- Dag Nygren email: dag@newtech.fi Oy Espoon NewTech Ab phone: +358 9 8024910 Träsktorpet 3 fax: +358 9 8024916 02360 ESBO Mobile: +358 400 426312 FINLAND
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Casey Duncan -
Dag Nygren