Logo Search packages:      
Sourcecode: zope-formulator version File versions  Download package

def Formulator::Form::ZMIForm::manage_addField (   self,
  id,
  title,
  fieldname,
  REQUEST = None 
)

Add a new field to the form.
id        -- the id of the field to add
title     -- the title of the field to add; this will be used in
     displays of the field on forms
fieldname -- the name of the field (meta_type) to add
Result    -- empty string

Definition at line 756 of file Form.py.

00756                                                                  :
        """Add a new field to the form.
        id        -- the id of the field to add
        title     -- the title of the field to add; this will be used in
                     displays of the field on forms
        fieldname -- the name of the field (meta_type) to add
        Result    -- empty string
        """
        title = string.strip(title)
        if not title:
            title = id # title is always required, use id if not provided
        if self.get_unicode_mode():
            title = convert_unicode(title)
        # get the field class we want to add
        field_class = FieldRegistry.get_field_class(fieldname)
        # create field instance
        field = field_class(id, title=title, description="")
        # add the field to the form
        id = self._setObject(id, field)
        # respond to add_and_edit button if necessary
        add_and_edit(self, id, REQUEST)
        return ''

    # security declaration for the generic "add field" form,
    # which is set as a class attribute in "initializeForm" later on
    security.declareProtected('Change Formulator Forms', 'fieldAdd')
    def fieldAdd(self):


Generated by  Doxygen 1.6.0   Back to index