Now that you understand basic HTML, it's time to see how it can be applied to Domino Designer. You can add HTML to a number of objects, such as hotspots, buttons , fields, views, forms, and pages. Beginning with Release 4.5, the "hooks" for HTML in a Domino database have increased, and in R5 and now Domino 6, you can add HTML to documents, pages, forms, fields, views, and many different objects. Some of these objects, such as fields and hotspots, have an Extra Field HTML tab on the properties box.
Converting Forms, Pages, and Subforms to HTML
A great new feature in Domino 6 allows designers to convert some or all content on a page, form, or subform directly into HTML on the fly. Designers then can use the HTML Editor to make changes to the HTML source code directly. Here's how:
Figure 20.5. Converting page, form, or subform content to HTML.
TIP
If part of your design is mistakenly converted to HTML, choose Edit, Undo Delete to recover your design. Do not choose Edit, Convert to Notes. The reconversion is not exact: Buttons that have Web or client JavaScript associated with the Click event are converted to HTML as expected. However, it is recommended that you not to convert buttons that do not have Web or client JavaScript associated with the Click event as a precaution.
Figure 20.6. Viewing the HTML pane in Domino Designer.
Importing HTML
Importing HTML code into Domino is very easy to do. To import HTML, you must first save the document that contains the HTML code you want to import.
You can then edit the HTML code directly in the Domino HTML editor via the HTML pane (View, HTML Pane) with your page, form, or subform.
Adding HTML Head Content
Open a database in the Domino Designer and follow these instructions:
"This is my bold text"
Adding HTML Attributes to a Field
Domino provides two places for designers to attach HTML to a field: The Field Extra HTML tab on the Field properties box and the HTML Attributes field event in the Objects pane.
To add HTML attributes, using the Field properties box, follow these steps:
SIZE=80 MAXLENGTH=100
The maxlength value defines the length of the text content a user can enter into the field. It is generally good practice to keep the maxlength value approximately 30% larger than the size value, to enable a user to completely fill a field with text.
To add HTML attributes using the field's HTML Attributes event:
"ROWS=10 COLS=50"
A rich-text field accepts ROWS and COLS tags to define the number of rows (height) and columns (width) that the browser displays for the field. For example, the following attribute sets the number of rows to 20 and the columns to 60 (see Figure 20.7):
"ROWS=20 COLS=60"
Figure 20.7. The HTML attributes of text and rich-text fields can be used to control the display of the field to a Web client.
Adding the ROWS and COLS attributes to a rich-text field controls both the width ( COLS ) and the height ( ROWS ). Figure 20.8 shows the effects of setting the HTML attributes on text and rich-text fields.
Figure 20.8. Setting the HTML attributes of fields defines the way the field is displayed by the browser.
The HTML tab of the Field properties box is shown in Figure 20.8. This tab enables you to define several different aspects of an object. Table 20.5 describes each of the settings on the
tab.
Table 20.5. The
Tab of the Field Properties Box
Attribute | Description |
---|---|
Name | Names the object, which can be referenced by JavaScript or with a style sheet |
Id | Used to reference the object by JavaScript or with a style sheet |
Class | Used to apply a class from a style sheet |
Style | Applies a specific style to an object from a style sheet |
Title | Used to provide a tip or a prompt to a user |
Other | Adds other attributes (don't use quotes) for the object |
The Name attribute is preset for fields but is available for other objects, such as buttons. The Id attribute is similar to the Name attribute, and both are used to reference the object with JavaScript or a Cascading Style Sheet. Class and Style are used to apply styles from a style sheet. The Title attribute (at least in Internet Explorer) provides a little prompt box with the text you include when the mouse passes over the field or object (see Figure 20.9). Trick: Some designers also use this tag to pass field help or hints to the Web user.
Figure 20.9. Adding text (without quotes) to the Title attribute of an object produces a floating box in Internet Explorer; note the box Rich Text Field.
CAUTION
The Title attribute appears to function only in Internet Explorer. It does not work in Netscape 4.51 or in the Notes browser.
You can use the Other property to add additional HTML attributes to objects. For the most part, you can get at all the HTML attributes you'll ever need, so you'll rarely use this property. In the Other field, unlike the remaining fields on this tab, you must use quotation marks and identify the attribute. The syntax is as follows :
Attribute = "value"
Attributes entered into the HTML tab are incorporated into the document when it is presented to a Web client.
Using HTML in Forms and Pages
In addition to the techniques discussed previously, there are other ways to use HTML in forms, pages, and subforms. On the Advanced tab of the Form properties box is the setting Web Access: Treat Document Contents as HTML. Pages have a similar setting for Web Access Treat Page Contents as HTML on the Page Info tab. You can click this setting for either a page or a form, and then you can add HTML to the design object.
Pass-thru HTML became much more functional in R5 and Designer 6. In R4.6, pass-thru HTML wasn't very "sticky." That is, it didn't always stay set to pass-thru HTML; if you modified a form, the setting often disappeared. Now the text you've selected for pass-thru HTML shows up with a gray background so you always know when it's set.
CAUTION
If you try to create an HTML document with and other form tags, Domino produces an error message: Documents treated as HTML cannot be edited .
Because Domino creates all the necessary elements to create a basic HTML documentthat is, the
tags,
tags, appropriate JavaScript, and so onit doesn't make that much sense to completely re-create an HTML document from scratch within a page or a form. To get around this, select On Access Content Type to Notes and then select the option Generate HTML for All Fields on the Defaults tab of the form's InfoBox.
Using Reserved Fields
At present, three fields are reserved for HTML: $$HTMLHead, $$Return, and HTML. $$HTMLHead is a leftover from earlier versions of Notes and Domino. This field enables you to insert tags into the HEAD of an HTML document. It is not really needed any longer because forms and pages contain the HTML Head Content event. As with the HTML Head Content event, $$HTMLHead can take all sorts of tags, such as ,
Part I. Introduction to Release 6
Whats New in Release 6?
The Release 6 Object Store
The Integrated Development Environment
Part II. Foundations of Application Design
Forms Design
Advanced Form Design
Designing Views
Using Shared Resources in Domino Applications
Using the Page Designer
Creating Outlines
Adding Framesets to Domino Applications
Automating Your Application with Agents
Part III. Programming Domino Applications
Using the Formula Language
Real-World Examples Using the Formula Language
Writing LotusScript for Domino Applications
Real-World LotusScript Examples
Writing JavaScript for Domino Applications
Real-World JavaScript Examples
Writing Java for Domino Applications
Real-World Java Examples
Enhancing Domino Applications for the Web
Part IV. Advanced Design Topics
Accessing Data with XML
Accessing Data with DECS and DCRs
Security and Domino Applications
Creating Workflow Applications
Analyzing Domino Applications
Part V. Appendices
Appendix A. HTML Reference
Appendix B. Domino URL Reference