I was recently working on a similar problem.
 You will need to use the xmlhttprequest function in _javascript_ do all the work. And its quite easy once you get the hang of it. Heres a good tutorial to get started:

For your problem, if your required server result is a simple list, let a zope script generate a tab-delimited list and you can retrive it using the request.responseText (see the xmlhttprequest) and skip working with the XMLDOM, which can by quite annoying.


Message: 8
Date: Wed, 29 Jun 2005 12:20:17 -0700 (PDT)
From: Rob Boyd <[EMAIL PROTECTED]>
Subject: [Zope] TAL and _javascript_
Content-Type: text/plain; charset=iso-8859-1

Thanks to all the responders. It gave me some ideas, but alas no luck.

To clarify, I am not trying to do everything in one request. Request
one generates the page, a user event (selecting an option from a form)
fires another request via _javascript_.

<script tal:content="python:'function getFormats() {
   var widget = document.getElementById('orgs');
   var chosen_org = widget.options[widget.selectedIndex].value;
   var formats = %s;
   // build selection 2 options from formats
   ' % here.getDataFormats(chosen_org)" />

And then a user event (onChange) calls getFormats.

Even with generating the script with a Python script or DTML, the
problem remains (for me at least) to get a value from the DOM passed as
an argument to a Python script that queries my database. If my Python
script didn't take an argument, I'd have no problem. I could do this
and use _javascript_ to build the select options from the appropriate
values. But I'd like to cut down on what the browser has to handle.
What the user chooses in the first selection can reduce what they get
to choose in selection two from 3000 choices to hundreds. I'd prefer to
have the backend reduce the result set rather than having the browser
do the work.

I thought about AJAX (no experience), but given time constraints, looks
like I'll have to load everything on the page and go from there.

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to