Custom files are very useful, but they cannot, for instance, change the order in which elements are displayed. Custom forms, instead, are a much powerful feature that allows to structure freely ERW's editing forms.
A custom form is defined by an XML document in ERF. Once the form has been created, it must be compiled using ERtool and the resulting PHP file must be installed in the custom form directory (which is defined by a suitable configuration variable).
Forms may present the user with information in different order, different language, different level of authorisation, and so on. To provide maximum flexibility, ERW defines a form resolution procedure that determines the form that will be actually loaded in a certain circumstance.
First of all, form resolution is based on a key, which by default is given by the name of the type of the element the form will be used with. Thus, the default key for the form of a book is book. Once the key is determined, ERW tries first to find a form named key.current-locale.php, e.g., book.it-IT.php. If the form cannot be found, ERW will try key.current-language.php, e.g., book.it.php. Finally, ERW will try to load key.php, e.g., book.php (this process is very similar to the one used by Apache to load language-dependent pages).
ERF is an XML-based language that is used to describe custom forms.
Note that there are two kind of forms: embedded and non-embedded. Non-embedded forms are the standard ones: using them, you alter each element of an ERW database. Embedded forms, on the other hand, allow you to edit relationships directly into the form of an entity, or to edit weak entities directly into the form of the owner. The main difference is that non-absorbed relationship types and filesets cannot be part of an embedded form.
Before giving the reference to ERF elements, it is useful to have an informal discussion of what you can describe in ERF.
ERF documents looks really like XHTML documents. Indeed,
ERF contains a selection of XHTML elements (e.g.,
div, style, ecc.) and a custom
form looks like a simplified XHTML page. The interesting point,
however, is that placing suitably
elements you can place freely ERW input controls and lists along
the page. If you want to have a look at sample ERF custom forms,
ERtool can produce for each type a
form giving the standard look. For instance, the form produced for a
person looks as follows:
<?xml version="1.0"?> <!DOCTYPE erf PUBLIC "-//DSI//DTD ERF V1.0//EN" "file://erf.dtd"> <erf ref="person"> <input ref="fname"/> <input ref="lname"/> <list ref="loan_book"/> </erf>
A corrsponding customised form has been shown in the Section called A Simple Example in Preface (more precisely, in Figure 7 in the Section called A Simple Example in Preface).
In this section we list all ERF elements, giving in detail
their usage and meaning. First of all, there are XHTML-like
img, which possess
style attributes, and an element
style with attribute
type. The element
img has also attributes
height. Finally, there is
a with an additional attribute
href, but note that for obvious
reasons the linked page will be always opened in a new window.
For the meaning of these elements
and attributes, please refer to the HTML or XHTML