beautypg.com

Adding the finishing touches, Clearing the guest list, Adding the finishing touches 56 – Apple WebObjects 3.5 User Manual

Page 56: Clearing the guest list 56

background image

Chapter 2

Enhancing Your Application

56

By using the name

currentGuest

for the

item

attribute, you are taking advantage

of the fact that the strings in your table are already bound to the fields of

currentGuest

.

You now have finished implementing the repetition. When the table is
generated, it will have one row for each item in the

allGuests

array.

15. Save the GuestList component.

16. Delete the table from Main, since you no longer need it.

17. Build and launch your application.

18. Test your application by entering data for multiple guests and verifying that

each guest appears in the table.

Adding the Finishing Touches

There are a few additional things you’ll do to make your application a bit more
user friendly:

Add a button that, when clicked, clears the guest list.

Add a hyperlink to the GuestList page that allows users to return to the
Main page.

Clearing the Guest List

While developing your application, you may find it useful to be able to remove
all guests from the list. (Typically, you wouldn’t allow users to remove all guests
from the list.)

1. In WebObjects Builder, make the GuestList component window active.

2. Choose Add Action from the pull-down menu at the bottom of the window.

In the panel, enter

clearGuestList

as the name of the action and set the

page returned to

nil

.

3. Choose View Source File from the pull-down menu.

Project Builder displays the code for

GuestList.wos

. You’ll notice that there is a

skeleton of the

clearGuestList

action method, using WebScript syntax, as well

as the declaration for

currentGuest

that you created previously.