Documentation Archive Developer
Search
Table of Contents Previous Section 

Binding Elements

This section discusses the basic techniques you use to bind elements. Further detail is presented in the sections that discuss specific dynamic elements.

 

In the figure, you have added a dynamic text field (WOTextField) to your component. Note the blue triangle in the top left corner, which distinguishes the dynamic text field from a static HTML text field. The long rectangle surrounding the text field represents the form of which it is a part.

 To bind the text field to the variable myVar:

 

  1. Click myVar in the object browser and drag to inside the text field. 
  2. A black line appears as you drag, and a black border appears around the text field, indicating that you can bind to it.

     

  3. Release the mouse button. 
  4. The Inspector for that element appears, listing its attributes. The value attribute is selected by default. (This attribute represents the value that the user enters into the text field.) If this isn't the attribute you wish to bind, click another attribute to select it.

     

  5. To complete the binding, click the Connect Variable button. 
  6. The name of the variable appears in the Binding column next to the attribute. Note that it also appears inside the text field in the component window. Some (not all) dynamic elements display the binding for their default attribute inside the element itself.

     

  7. If you change your mind, you can click the Inspector's Disconnect button (which changed from Connect Variable) to undo the binding.
There are two other buttons on the bottom of the Inspector window:

 

To create an additional binding for the same element:
  1. Drag from an item in the object browser to the element as before. 
  2. This time, a different attribute is selected, since the default attribute has already been bound.

     

  3. Click Connect Variable to bind the selected attribute. 
  4. If, instead, you want to bind an attribute that has already been bound, double-click its row, and the old binding is replaced with the new one.
You can also bind an element's attributes by typing in the Inspector without going through the dragging procedure. To do this:

 

  1. Double-click in the binding column of the row for the attribute you want to set. 
  2. A cursor appears in the Binding column, allowing you to type.

     

  3. Type the binding in the text field, then press Enter.
When entering bindings this way, the following rules apply:

 

Table of Contents Next Section