The Domino Designer Quickstart Tutorial1 41 50
The Domino Designer Quickstart Tutorial1 41 50
The Domino Designer Quickstart Tutorial1 41 50
@Command([FileCloseWindow]);
@Command([OpenFrameset];"Sales")
Click the checkmark button to save the script.
When a Contact document is opened in Read mode, it requires two additional actions:
"Edit Contact", and "Close".
"Edit Contact" puts the document into Edit mode - which allows the visitor to update
the information in the form.
"Close" simply closes the form. It actually does the exact same thing as "Cancel".
However, in Read mode, it's more appropriate to have a button that says "Close", than it
is to have "Cancel", because the user cannot make any changes that require cancelling.
We'll create these buttons first. Then in a later section, we'll see how to set the Hide
properties of the actions to get the right buttons to display in Edit mode and Read mode.
This creates the new action, and brings up the Action Properties box, with focus in the
Name field. Set the name to "Edit Contact".
Still in the first panel of the Action Properties box, set Graphic to Custom.
In the Image field, click the folder icon to bring up the list of image resources. Choose
"act_editcontact.gif".
Enter the following Formula script into the Programmer's pane (you can copy and paste
the text):
@Command([EditDocument])
Click the checkmark button to save the script.
This creates the new action, and brings up the Action Properties box, with focus in the
Name field. Set the name to "Close".
Still in the first panel of the Action Properties box, set Graphic to Custom.
In the Image field, click the folder icon to bring up the list of image resources. Choose
"act_closecontact.gif".
Enter the following Formula script into the Programmer's pane (you can copy and paste
the text):
@Command([FileCloseWindow]);
@Command([OpenFrameset];"Sales")
The Hide action from section lets you hide or show the actions based on whether the
user is using the Notes client to view your application, or a Web browser.
The Hide action if formula is true section gives you full control over when to hide or
show a button by specifying a formula.
For the action buttons in the Contact form, we'll use the Hide action when document is
section. This lets you easily specify which buttons are visible in Read mode, and which
are visible in Edit mode.
"Save & Close" should be available when in Edit mode, so it should be hidden when in
Read mode.
Select the checkboxes Previewed for reading and Opened for reading as shown
below:
Note: We won't be using the "Previewed for reading" feature in this tutorial. This refers
to designing the application so that a document is opened for reading in a separate frame
when it's selected in a View frame. However, when setting the Hide property, it's
typically the case that the actions you want hidden for "Previewed for reading" and
"Opened for reading" are the same.
"Cancel" should be available when in Edit mode, so it should be hidden when in Read
mode.
"Edit Contact" should be available when in Read mode, so it should be hidden when in
Edit mode.
Select the checkboxes Previewed for editing and Opened for editing as shown below:
"Close" should be available when in Read mode, so it should be hidden when in Edit
mode.
Select the checkboxes Previewed for editing and Opened for editing as shown below:
You can now click back in the Designer window and close the "Contact" form.
8. Creating a View to Organize and Display Documents
In this section...
As explained in the previous lesson, "Creating a Form", when a site visitor enters
information about a contact into the contact form, a contact document is created to store
that information in the Domino database. Now we need a way to view those stored
contact documents. That's where views come in. Views provide a way to organize and
display documents.
Unlike some of the other building blocks we've covered so far, even if you're familiar
with other Web development environments, you may not have seen anything like
Domino views before!
From the point of view of the application developer, (you, that is), you don't have to
resort to CGI scripts or other difficult mechanisms for handling input from users. As
you'll see, you specify the properties of one or more Views, and Domino takes care of
creating documents from the information submitted by users, and displaying the
documents in views.
From the point of view of the end user, views provide a flexible and intuitive way for
documents to be organized. Users can easily see lists of documents, sort the lists in
different ways, open documents for reading or editing, and create new documents. This
will all become more clear when you see views in action.
In this section we'll create a view called "Contact Management" for displaying contact
information documents. The view will look something like this when viewed from a
Web browser:
Notice some of the key points of what you see in the view above:
When you select the Views design element, the Work pane displays a list of the existing
views. Since you haven't created any views yet, the only view in the list is the default
"untitled" view:
Click anywhere in the Work pane. Choose Design - View Properties to bring up the
View Properties box:
To specify the use of the view applet on the Web, select the Use applet in the browser
option.
There's a default column in the database, with the label "#". We'll create the Company
column by modifying this one.
Select the second tab of the Column Properties box. This is the sorting tab:
There are a number of different options for sorting and categorizing. The option we'll
set is to allow the end user to adjust the sorting option on the fly.
Select Click on column header to sort. In the dropdown list, choose Both. The user
can now sort on the Company column by clicking once to sort ascending, clicking again
to sort descending, and clicking again to remove the sort on this column.
The Programmer's pane is where you set the value to display in the selected column. If
the Programmer's pane isn't currently open, open it by clicking on the frame selector at
the bottom edge of the Designer window and drag up to the desired size:
The Display option let's you specify the method to use for specifying what to display in
the column. We'll use the Field method, which lets you simply pick a field from a list.
The list displays the names of all the fields in the Contact form. Select Company from
the list.
Choose Create - Append New Column. This creates a new column immediately after
the selected column.
Double-click the new column to bring up the Column Properties box. Set the title to
"Contact".
Select the Sorting tab, (second tab), of the Column Properties box. Select Click on
column header to sort. In the dropdown list, choose Both.
In the Programmer;s pane, set Display to Field. Choose Contact from the list of fields.
Choose Create - Append New Column. This creates a new column immediately after
the selected column.
Double-click the new column to bring up the Column Properties box. Set the title to
"Type".
Select the Sorting tab, (second tab), of the Column Properties box. Select Click on