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


   

Creating Form-Based Dynamic HTML Elements

In this section, you'll create a form with several elements to capture input from a guest. The Submit and Reset buttons you add to the form will apply to all other elements in the form. These elements look and act like HTML form elements but are actually dynamic WebObjects elements, which enable your code to receive and manipulate the data entered by the user. Refer to the screen shot that follows these steps to see how the window should look.

  1. Place the cursor on the second line after the "My Guest Book" text.

  2. Click .

    WebObjects Builder adds a form element to your component. The triangle at the upper-left corner indicates that it is a dynamic form, as opposed to a static form.The gray border indicates the extent of the form. You can increase its size by adding elements inside it.

  3. Type the text "Name: " and press Shift-Enter.
  4. This text replaces the word "Form" that was displayed by default.

  5. Type "E-mail: " and press Shift-Enter twice.

  6. Type "Comments: " followed by Shift-Enter.
  7. You have just entered three lines (and a blank line) of static text inside the form. Now you'll enter some dynamic elements to receive input from the user: two text fields and a multi-line text area.

  8. Place the cursor to the right of the text "Name: ".

  9. Click to create a dynamic text field element (WOTextField).

  10. Repeat steps 6 and 7 for "E-mail: ".

  11. Use the button to create a multi-line text area below the "Comments: " line.

  12. Press Shift-Enter twice to create two blank lines.

  13. Click to create a Submit button, which is used to send the data in the form to the server.

  14. Click to create a Reset button, which is used to clear the data in the form.

    The window should now look like this:


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