[Zope] Programmatically Adding Product from DTML

Dylan Reinhardt zope at dylanreinhardt.com
Fri Oct 10 21:32:31 EDT 2003


On Fri, 2003-10-10 at 14:43, Vern T Takebayashi wrote:
> Sorry if this has been asked before, but is there a way to add a product
> using DTML that goes to the initial form for setting properties (like id)

Yep.

> 
> For example,
> 
> <dtml-call "manage_addFolder('testfolder')">
> 
> causes a folder with an id of 'testfolder' to be created.  But, is there a
> way to go to the form that allows setting the id (instead of directly
> creating the folder without user interaction).

Yes... it's URL would be manage_addProduct/OFSP/folderAdd

> 
> The reason why I am asking is that I created a simple product that uses a
> form to initialize the product's properties.

In that case, the name of the add form is left up to you.  If you have
an interface called add*, that's probably it.

>   When, I select the Add drop
> down list and select my product, this form pops up and the action the form
> calls creates the product.  However, I would like to be able to view a
> page that will bring up the form and create the product in response to
> filling out the form.  

Here's a hot tip.  Anything the ZMI can do, you can do too.  Check out
the source behind that drop-down list and you should be able to figure
out the URL of your add form.  It's probably something like:

manage_addProduct/foo/fooAdd

where foo is the name of your product.

HTH,

Dylan




More information about the Zope mailing list