[Zope] Re: TAL and Javascript

2005-07-01 Thread Rushabh Mehta
Rob,

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:
http://developer.apple.com/internet/webcontent/xmlhttpreq.html

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.

Rushabh


Message: 8
Date: Wed, 29 Jun 2005 12:20:17 -0700 (PDT)
From: Rob Boyd [EMAIL PROTECTED]
Subject: [Zope] TAL and _javascript_
To: zope@zope.org
Message-ID: [EMAIL PROTECTED]
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_.

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

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] manage_edit for Page Templates

2005-04-25 Thread Rushabh Mehta
hi. there is a manage_edit() to modify the contents of a DTML
document. is there anything similar for page templates? i tried
manage_edit() on a page template and i get an attribute error for
manage_edit... the document_src() method works though
thanks
rushabh
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] manage_edit for Page Templates

2005-04-25 Thread Rushabh Mehta
thanks a lot, that works well... ill make it a point to hunt the sources, now that i know where to look :-)On 4/25/05, Phillip Hutchings 
[EMAIL PROTECTED] wrote:On 25/04/05, Rushabh Mehta 
[EMAIL PROTECTED] wrote: hi. there is a manage_edit()to modify the contents of a DTML document. is there anything similar for page templates? i tried manage_edit() on a page template and i get an attribute error for manage_edit... the document_src()
 method works thoughthanksrushabhA quick look atzope-2.7.4/lib/python/Products/PageTemplates/PageTemplate.py gives methis:def pt_edit(self, text, content_type):
Where text is the new content, and content_type is self explanatory.--Phillip Hutchingshttp://www.sitharus.com/[EMAIL PROTECTED]
 / [EMAIL PROTECTED]___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] object creation in a specific folder...

2005-04-10 Thread Rushabh Mehta
hello all,

this is my first zope app... i am trying to figure out how to create
an object in a particular folder via script, when my current object
may not be in the right tree...

I tried to do a 'change folder' via restrictedTraverse (eg 
context.getRestrictedTraverse('/myapp/myfolder'), and then create the
object using manage_addProduct... but it dosnt seem to work. any tips?

thanks,
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )