Most business templates ships with field libraries that are used by all forms
showing the same information. The idea is simply that the same configuration
should not be present in more than one place.
Table of Contents
Example¶
To have an easy example, we could use on the case of geographical address, it
is present on Person, on Organisation and on Address itself. We have
the following parts:
- Address_viewFieldLibrary contains all standards fields, such as zip code, address and region. It's what we call the field library.
- Person_view, Organisation_view and GeographicalAddress_view only contains proxy fields to the fields from the field library.
How to Customize a Field Library for specific needs¶
If for a given project you need to customize some fields, you just have to make
a copy of the field library and change the fields accordingly.
For example, you could change Address_viewFieldLibrary/my_region to use by
default your preferred region, or to only show leaves in the category tree ... etc.
You can easily configure all properties just like you configure any other fields,
but in the above example, as the field is named my_region, it will show and edit
the region property. Note that it's also possible to use another property instead.
This is what the non well known Alternate Name value on field is usefull. For
the example, if you want to allow multiple selection for region, you'll have to:
- change Address_viewFieldLibrary/my_region to be a multi list field;
- set Address_viewFieldLibrary/my_region Alternate name to my_region_list;
- set Address_viewFieldLibrary/my_region Default to this TALES: here/getRegionList.
How to create proxyfields¶
Notes¶
-
DO NOT give the proxy field an id same as the "target" (library) field. If
you do, it can do really crazy things (like running a TALES expression in a
context different from the context you are using the form). {X} I'm not sure
this is still true -jerome
-
See also: Guidelines for Field Libraries/Form Profixification
Related Articles¶