Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Getting Started With WebObjects


   

Binding the Input Elements

Each dynamic element contains several attributes. These attributes determine what happens when the element is displayed or when a form element is submitted. When you bind an element, you actually bind one or more of its attributes.

For example, a WOText element (which represents a multi-line text area) is defined as having two attributes:

In this tutorial, the only attribute you are concerned with is value, which represents the string entered by the user in the comments field. You'll bind this to the comments variable. You don't need to bind the name attribute in this application. In a later example, you'll bind more than one attribute of an element.

  1. In the object browser, make a connection by pressing on the comments variable and holding down the mouse button while dragging to the Comments text area. Then release the mouse button.

    A menu appears, displaying the attributes for the text area.

  2. Choose value.

    In the Dynamic Inspector, comments appears in the Binding column next to the value attribute of the text area, indicating that the binding has been made. Also, the text comments appears in the text field to show that it has been bound.

  3. We'll bind the guestName variable using another technique. Select the Name WOTextField element. In the Inspector, select the Dynamic Inspector.

    The Inspector displays the value attribute in red, indicating that this attribute must be bound; otherwise, WebObjects displays an error message when you try to run your application.

  4. In the Inspector, double-click in the Binding column next to value. Type g and press Enter. The Inspector fills in the rest of the "guestName" key for you.

  5. Bind the email variable to the corresponding text field using one of the methods above.

  6. Save the Main component.

© 1999 Apple Computer, Inc. – (Last Updated 24 Aug 99)