[Zope] TAL and Javascript
Rob Boyd
boydrobh at yahoo.com
Wed Jun 29 15:20:17 EDT 2005
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.
like:
<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.
Rob
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
More information about the Zope
mailing list