----- Original Message ----- From: "Nico Grubert" <nico@beehive.de> To: <zope@zope.org> Sent: Monday, February 14, 2000 5:01 AM Subject: [Zope] Adding ZClass Instances via DTML
This dtml-method calls another dtml-method "add_dtml" which looks like
this:
<dtml-call "REQUEST.set('id','<dtml-var newID>')"> <dtml-with "manage_addProduct['BuchProduct']"> <dtml-call "BuchClass_add(_.None,_, NoRedir=1)"> </dtml-with>
DTML tags don't work inside of other DTML tags. When you do <dtml-call "REQUEST...etc">, the stuff in quotes is actually a python expression. Which means, that if you want to use the newID variable, all you do is just put newID in there, like:
<dtml-call "REQUEST.set('id', newID)">
I think the rest of it looks good.
Kevin
Kevin, this makes no sense for me. Why should I add an instance by adding every time a new id and calling the method ?
The code that you're using is basically designed for adding ZClass instances automatically via DTML. For example, in KM|net News, when someone submits an article, the AddArticle method will take their form input and create a new ZClass instance. It automatically sets the ID of the new instances to a unix timestamp. AddArticle has a proxy role of "Manager" so that it can create the instance.
This really makes no sense for me ! I would like to use an input-type text and a submit button for adding an zclass-instances. Is this possible ?
If you have Manager permissions, you can do this via the management interface. (Just select your ZClass from the Add pulldown menu.) Or you can always create your own custom form and then add the ZClass instance based on that form. This is what I do in KM|net News. incoming.html is the form, AddArticle is the method which processes the form. Kevin