Personal tools
You are here: Home Weblog Archive 2006 July 21 How to access directly fields and widgets from an Archetypes content
Document Actions
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

How to access directly fields and widgets from an Archetypes content

by tibi last modified 2007-04-17 08:02
Filed Under:

There are two ways to access the field values and widgets from inside an AT content item.

First, a more complex example on getting fields and widgets properties using self.schema:

for fname in self.schema.keys():
    field = self.schema.get(fname)
    widget = field.widget
    widgetLabel = widget.Label(self)
    fieldValue = field.get(self))

To get a field value, one could use

 self.schema['customer_copy_to'].get(self)

The second way uses self.Schema() and shows the equivalent of the above example

self.Schema().getField('customer_copy_to').get(self)

Of course, there's always the default generated AT getters, but sometimes it's not possible to use those (for example, when you want to get the raw value of a field.

Weblog
Atom
RDF
RSS 2.0
Powered by Quills
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: