
Chapter 2 Dynamic Elements
34
In the .wod file, each element is identified by name and then its type is specified.
The outermost dynamic element in the HTML file
(OPTION_REPETITION) defines a WORepetition, the next element is a
WOHyperlink, and the innermost element is a WOString.
Each type specification is followed by a list of attributes. Dynamic elements
define several attributes that you bind to different values to configure the
element for your application. Usually, you bind attributes to variables or
methods from your component’s code (see Figure 12).
Figure 12. Dynamic Element Bindings
In the CyberWind example, the Main component binds to two attributes of
WORepetition:
list and item. The list attribute specifies the list that the
WORepetition should iterate over. The
item attribute specifies a variable whose
value will be updated in each iteration of the list (like an index variable in a
for
loop). CyberWind’s Main component binds the
list attribute to an array named
allOptions and the item attribute to a variable named currentOption.
The WOHyperlink has an
action attribute, which is bound to a method called
pickOptions. The action attribute specifies a method that should be invoked when
the user clicks the link. In this case, the
pickOptions method determines which link
the user clicked and then returns the appropriate page.
Record
value
action
TEXTFIELD : WOTextField {
value = aName;
}
Button : WOSubmitButton {
action = recordThis;
}
id aName;
- recordThis{
...
}
Kommentare zu diesen Handbüchern