Define an automatically generated add form
The addform directive creates and registers a view for adding an object based on a schema.
Adding an object is a bit trickier than editing an object, because the object the schema applies to isn't available when forms are being rendered. The addform directive provides a customization interface to overcome this difficulty.
See zope.app.form.browser.interfaces.IAddFormCustomization.
name
*
-
TextLine
(default =
None
)
The name of the generated view.
permission
*
-
Permission
(default =
None
)
The permission needed to use the view.
schema
*
-
GlobalInterface
(default =
None
)
The schema from which the form is generated.
arguments
-
Tokens
(default =
None
)
A list of field names to supply as positional arguments to the factory.
class_
-
GlobalObject
(default =
None
)
A class to provide custom widget definitions or methods to be used by a custom template.
This class is used as a mix-in class. As a result, it needn't subclass any special classes, such as BrowserView.
content_factory
-
GlobalObject
(default =
None
)
An object to call to create new content objects.
This attribute isn't used if a class is specified that implements createAndAdd.
content_factory_id
-
Id
(default =
None
)
A factory id to create new content objects
description
-
MessageID
(default =
None
)
A UI may display this with the item or display it when the user requests more assistance.
fields
-
Tokens
(default =
None
)
Here you can specify the names of the fields you wish to display. The order in this list is also the order the fields will be displayed in. If this attribute is not specified, all schema fields will be displayed in the order specified in the schema itself.
for_
-
GlobalInterface
(default =
None
)
The interface this page (view) applies to.
The view will be for all objects that implement this interface. The schema is used if the for attribute is not specified.
If the for attribute is specified, then the objects views must implement or be adaptable to the schema.
keyword_arguments
-
Tokens
(default =
None
)
A list of field names to supply as keyword arguments to the factory.
label
-
MessageID
(default =
None
)
A label to be used as the heading for the form.
layer
-
LayerField
(default =
None
)
The later the view is in. Default: 'default'
menu
-
MenuField
(default =
None
)
Many views are included in menus. It's convenient to name the menu in the page directive, rather than having to give a separate menuItem directive.
set_after_add
-
Tokens
(default =
None
)
A list of fields to be assigned to the newly created object after it is added.
set_before_add
-
Tokens
(default =
None
)
A list of fields to be assigned to the newly created object before it is added.
template
-
Path
(default =
None
)
An alternate template to use for the form.
title
-
MessageID
(default =
None
)
The browser menu label for the form.
Register custom widgets for a form.
This directive allows you to quickly generate custom widget directives for a form.
Besides the two required arguments, field and class, you can specify any amount of keyword arguments, e.g. style='background-color:#fefefe;'. The keywords will be stored as attributes on the widget instance. To see which keywords are sensible, you should look at the code of the specified widget class.
field
*
-
TextLine
(default =
None
)
The name of the field/attribute/property for which this widget will be used.
class_
-
GlobalObject
(default =
None
)
The class that will create the widget.
* = required